filters.texi 457 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aemphasis
  420. Audio emphasis filter creates or restores material directly taken from LPs or
  421. emphased CDs with different filter curves. E.g. to store music on vinyl the
  422. signal has to be altered by a filter first to even out the disadvantages of
  423. this recording medium.
  424. Once the material is played back the inverse filter has to be applied to
  425. restore the distortion of the frequency response.
  426. The filter accepts the following options:
  427. @table @option
  428. @item level_in
  429. Set input gain.
  430. @item level_out
  431. Set output gain.
  432. @item mode
  433. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  434. use @code{production} mode. Default is @code{reproduction} mode.
  435. @item type
  436. Set filter type. Selects medium. Can be one of the following:
  437. @table @option
  438. @item col
  439. select Columbia.
  440. @item emi
  441. select EMI.
  442. @item bsi
  443. select BSI (78RPM).
  444. @item riaa
  445. select RIAA.
  446. @item cd
  447. select Compact Disc (CD).
  448. @item 50fm
  449. select 50µs (FM).
  450. @item 75fm
  451. select 75µs (FM).
  452. @item 50kf
  453. select 50µs (FM-KF).
  454. @item 75kf
  455. select 75µs (FM-KF).
  456. @end table
  457. @end table
  458. @section aeval
  459. Modify an audio signal according to the specified expressions.
  460. This filter accepts one or more expressions (one for each channel),
  461. which are evaluated and used to modify a corresponding audio signal.
  462. It accepts the following parameters:
  463. @table @option
  464. @item exprs
  465. Set the '|'-separated expressions list for each separate channel. If
  466. the number of input channels is greater than the number of
  467. expressions, the last specified expression is used for the remaining
  468. output channels.
  469. @item channel_layout, c
  470. Set output channel layout. If not specified, the channel layout is
  471. specified by the number of expressions. If set to @samp{same}, it will
  472. use by default the same input channel layout.
  473. @end table
  474. Each expression in @var{exprs} can contain the following constants and functions:
  475. @table @option
  476. @item ch
  477. channel number of the current expression
  478. @item n
  479. number of the evaluated sample, starting from 0
  480. @item s
  481. sample rate
  482. @item t
  483. time of the evaluated sample expressed in seconds
  484. @item nb_in_channels
  485. @item nb_out_channels
  486. input and output number of channels
  487. @item val(CH)
  488. the value of input channel with number @var{CH}
  489. @end table
  490. Note: this filter is slow. For faster processing you should use a
  491. dedicated filter.
  492. @subsection Examples
  493. @itemize
  494. @item
  495. Half volume:
  496. @example
  497. aeval=val(ch)/2:c=same
  498. @end example
  499. @item
  500. Invert phase of the second channel:
  501. @example
  502. aeval=val(0)|-val(1)
  503. @end example
  504. @end itemize
  505. @anchor{afade}
  506. @section afade
  507. Apply fade-in/out effect to input audio.
  508. A description of the accepted parameters follows.
  509. @table @option
  510. @item type, t
  511. Specify the effect type, can be either @code{in} for fade-in, or
  512. @code{out} for a fade-out effect. Default is @code{in}.
  513. @item start_sample, ss
  514. Specify the number of the start sample for starting to apply the fade
  515. effect. Default is 0.
  516. @item nb_samples, ns
  517. Specify the number of samples for which the fade effect has to last. At
  518. the end of the fade-in effect the output audio will have the same
  519. volume as the input audio, at the end of the fade-out transition
  520. the output audio will be silence. Default is 44100.
  521. @item start_time, st
  522. Specify the start time of the fade effect. Default is 0.
  523. The value must be specified as a time duration; see
  524. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  525. for the accepted syntax.
  526. If set this option is used instead of @var{start_sample}.
  527. @item duration, d
  528. Specify the duration of the fade effect. See
  529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  530. for the accepted syntax.
  531. At the end of the fade-in effect the output audio will have the same
  532. volume as the input audio, at the end of the fade-out transition
  533. the output audio will be silence.
  534. By default the duration is determined by @var{nb_samples}.
  535. If set this option is used instead of @var{nb_samples}.
  536. @item curve
  537. Set curve for fade transition.
  538. It accepts the following values:
  539. @table @option
  540. @item tri
  541. select triangular, linear slope (default)
  542. @item qsin
  543. select quarter of sine wave
  544. @item hsin
  545. select half of sine wave
  546. @item esin
  547. select exponential sine wave
  548. @item log
  549. select logarithmic
  550. @item ipar
  551. select inverted parabola
  552. @item qua
  553. select quadratic
  554. @item cub
  555. select cubic
  556. @item squ
  557. select square root
  558. @item cbr
  559. select cubic root
  560. @item par
  561. select parabola
  562. @item exp
  563. select exponential
  564. @item iqsin
  565. select inverted quarter of sine wave
  566. @item ihsin
  567. select inverted half of sine wave
  568. @item dese
  569. select double-exponential seat
  570. @item desi
  571. select double-exponential sigmoid
  572. @end table
  573. @end table
  574. @subsection Examples
  575. @itemize
  576. @item
  577. Fade in first 15 seconds of audio:
  578. @example
  579. afade=t=in:ss=0:d=15
  580. @end example
  581. @item
  582. Fade out last 25 seconds of a 900 seconds audio:
  583. @example
  584. afade=t=out:st=875:d=25
  585. @end example
  586. @end itemize
  587. @section afftfilt
  588. Apply arbitrary expressions to samples in frequency domain.
  589. @table @option
  590. @item real
  591. Set frequency domain real expression for each separate channel separated
  592. by '|'. Default is "1".
  593. If the number of input channels is greater than the number of
  594. expressions, the last specified expression is used for the remaining
  595. output channels.
  596. @item imag
  597. Set frequency domain imaginary expression for each separate channel
  598. separated by '|'. If not set, @var{real} option is used.
  599. Each expression in @var{real} and @var{imag} can contain the following
  600. constants:
  601. @table @option
  602. @item sr
  603. sample rate
  604. @item b
  605. current frequency bin number
  606. @item nb
  607. number of available bins
  608. @item ch
  609. channel number of the current expression
  610. @item chs
  611. number of channels
  612. @item pts
  613. current frame pts
  614. @end table
  615. @item win_size
  616. Set window size.
  617. It accepts the following values:
  618. @table @samp
  619. @item w16
  620. @item w32
  621. @item w64
  622. @item w128
  623. @item w256
  624. @item w512
  625. @item w1024
  626. @item w2048
  627. @item w4096
  628. @item w8192
  629. @item w16384
  630. @item w32768
  631. @item w65536
  632. @end table
  633. Default is @code{w4096}
  634. @item win_func
  635. Set window function. Default is @code{hann}.
  636. @item overlap
  637. Set window overlap. If set to 1, the recommended overlap for selected
  638. window function will be picked. Default is @code{0.75}.
  639. @end table
  640. @subsection Examples
  641. @itemize
  642. @item
  643. Leave almost only low frequencies in audio:
  644. @example
  645. afftfilt="1-clip((b/nb)*b,0,1)"
  646. @end example
  647. @end itemize
  648. @anchor{aformat}
  649. @section aformat
  650. Set output format constraints for the input audio. The framework will
  651. negotiate the most appropriate format to minimize conversions.
  652. It accepts the following parameters:
  653. @table @option
  654. @item sample_fmts
  655. A '|'-separated list of requested sample formats.
  656. @item sample_rates
  657. A '|'-separated list of requested sample rates.
  658. @item channel_layouts
  659. A '|'-separated list of requested channel layouts.
  660. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  661. for the required syntax.
  662. @end table
  663. If a parameter is omitted, all values are allowed.
  664. Force the output to either unsigned 8-bit or signed 16-bit stereo
  665. @example
  666. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  667. @end example
  668. @section agate
  669. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  670. processing reduces disturbing noise between useful signals.
  671. Gating is done by detecting the volume below a chosen level @var{threshold}
  672. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  673. floor is set via @var{range}. Because an exact manipulation of the signal
  674. would cause distortion of the waveform the reduction can be levelled over
  675. time. This is done by setting @var{attack} and @var{release}.
  676. @var{attack} determines how long the signal has to fall below the threshold
  677. before any reduction will occur and @var{release} sets the time the signal
  678. has to rise above the threshold to reduce the reduction again.
  679. Shorter signals than the chosen attack time will be left untouched.
  680. @table @option
  681. @item level_in
  682. Set input level before filtering.
  683. Default is 1. Allowed range is from 0.015625 to 64.
  684. @item range
  685. Set the level of gain reduction when the signal is below the threshold.
  686. Default is 0.06125. Allowed range is from 0 to 1.
  687. @item threshold
  688. If a signal rises above this level the gain reduction is released.
  689. Default is 0.125. Allowed range is from 0 to 1.
  690. @item ratio
  691. Set a ratio by which the signal is reduced.
  692. Default is 2. Allowed range is from 1 to 9000.
  693. @item attack
  694. Amount of milliseconds the signal has to rise above the threshold before gain
  695. reduction stops.
  696. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  697. @item release
  698. Amount of milliseconds the signal has to fall below the threshold before the
  699. reduction is increased again. Default is 250 milliseconds.
  700. Allowed range is from 0.01 to 9000.
  701. @item makeup
  702. Set amount of amplification of signal after processing.
  703. Default is 1. Allowed range is from 1 to 64.
  704. @item knee
  705. Curve the sharp knee around the threshold to enter gain reduction more softly.
  706. Default is 2.828427125. Allowed range is from 1 to 8.
  707. @item detection
  708. Choose if exact signal should be taken for detection or an RMS like one.
  709. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  710. @item link
  711. Choose if the average level between all channels or the louder channel affects
  712. the reduction.
  713. Default is @code{average}. Can be @code{average} or @code{maximum}.
  714. @end table
  715. @section alimiter
  716. The limiter prevents an input signal from rising over a desired threshold.
  717. This limiter uses lookahead technology to prevent your signal from distorting.
  718. It means that there is a small delay after the signal is processed. Keep in mind
  719. that the delay it produces is the attack time you set.
  720. The filter accepts the following options:
  721. @table @option
  722. @item level_in
  723. Set input gain. Default is 1.
  724. @item level_out
  725. Set output gain. Default is 1.
  726. @item limit
  727. Don't let signals above this level pass the limiter. Default is 1.
  728. @item attack
  729. The limiter will reach its attenuation level in this amount of time in
  730. milliseconds. Default is 5 milliseconds.
  731. @item release
  732. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  733. Default is 50 milliseconds.
  734. @item asc
  735. When gain reduction is always needed ASC takes care of releasing to an
  736. average reduction level rather than reaching a reduction of 0 in the release
  737. time.
  738. @item asc_level
  739. Select how much the release time is affected by ASC, 0 means nearly no changes
  740. in release time while 1 produces higher release times.
  741. @item level
  742. Auto level output signal. Default is enabled.
  743. This normalizes audio back to 0dB if enabled.
  744. @end table
  745. Depending on picked setting it is recommended to upsample input 2x or 4x times
  746. with @ref{aresample} before applying this filter.
  747. @section allpass
  748. Apply a two-pole all-pass filter with central frequency (in Hz)
  749. @var{frequency}, and filter-width @var{width}.
  750. An all-pass filter changes the audio's frequency to phase relationship
  751. without changing its frequency to amplitude relationship.
  752. The filter accepts the following options:
  753. @table @option
  754. @item frequency, f
  755. Set frequency in Hz.
  756. @item width_type
  757. Set method to specify band-width of filter.
  758. @table @option
  759. @item h
  760. Hz
  761. @item q
  762. Q-Factor
  763. @item o
  764. octave
  765. @item s
  766. slope
  767. @end table
  768. @item width, w
  769. Specify the band-width of a filter in width_type units.
  770. @end table
  771. @anchor{amerge}
  772. @section amerge
  773. Merge two or more audio streams into a single multi-channel stream.
  774. The filter accepts the following options:
  775. @table @option
  776. @item inputs
  777. Set the number of inputs. Default is 2.
  778. @end table
  779. If the channel layouts of the inputs are disjoint, and therefore compatible,
  780. the channel layout of the output will be set accordingly and the channels
  781. will be reordered as necessary. If the channel layouts of the inputs are not
  782. disjoint, the output will have all the channels of the first input then all
  783. the channels of the second input, in that order, and the channel layout of
  784. the output will be the default value corresponding to the total number of
  785. channels.
  786. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  787. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  788. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  789. first input, b1 is the first channel of the second input).
  790. On the other hand, if both input are in stereo, the output channels will be
  791. in the default order: a1, a2, b1, b2, and the channel layout will be
  792. arbitrarily set to 4.0, which may or may not be the expected value.
  793. All inputs must have the same sample rate, and format.
  794. If inputs do not have the same duration, the output will stop with the
  795. shortest.
  796. @subsection Examples
  797. @itemize
  798. @item
  799. Merge two mono files into a stereo stream:
  800. @example
  801. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  802. @end example
  803. @item
  804. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  805. @example
  806. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  807. @end example
  808. @end itemize
  809. @section amix
  810. Mixes multiple audio inputs into a single output.
  811. Note that this filter only supports float samples (the @var{amerge}
  812. and @var{pan} audio filters support many formats). If the @var{amix}
  813. input has integer samples then @ref{aresample} will be automatically
  814. inserted to perform the conversion to float samples.
  815. For example
  816. @example
  817. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  818. @end example
  819. will mix 3 input audio streams to a single output with the same duration as the
  820. first input and a dropout transition time of 3 seconds.
  821. It accepts the following parameters:
  822. @table @option
  823. @item inputs
  824. The number of inputs. If unspecified, it defaults to 2.
  825. @item duration
  826. How to determine the end-of-stream.
  827. @table @option
  828. @item longest
  829. The duration of the longest input. (default)
  830. @item shortest
  831. The duration of the shortest input.
  832. @item first
  833. The duration of the first input.
  834. @end table
  835. @item dropout_transition
  836. The transition time, in seconds, for volume renormalization when an input
  837. stream ends. The default value is 2 seconds.
  838. @end table
  839. @section anequalizer
  840. High-order parametric multiband equalizer for each channel.
  841. It accepts the following parameters:
  842. @table @option
  843. @item params
  844. This option string is in format:
  845. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  846. Each equalizer band is separated by '|'.
  847. @table @option
  848. @item chn
  849. Set channel number to which equalization will be applied.
  850. If input doesn't have that channel the entry is ignored.
  851. @item cf
  852. Set central frequency for band.
  853. If input doesn't have that frequency the entry is ignored.
  854. @item w
  855. Set band width in hertz.
  856. @item g
  857. Set band gain in dB.
  858. @item f
  859. Set filter type for band, optional, can be:
  860. @table @samp
  861. @item 0
  862. Butterworth, this is default.
  863. @item 1
  864. Chebyshev type 1.
  865. @item 2
  866. Chebyshev type 2.
  867. @end table
  868. @end table
  869. @item curves
  870. With this option activated frequency response of anequalizer is displayed
  871. in video stream.
  872. @item size
  873. Set video stream size. Only useful if curves option is activated.
  874. @item mgain
  875. Set max gain that will be displayed. Only useful if curves option is activated.
  876. Setting this to reasonable value allows to display gain which is derived from
  877. neighbour bands which are too close to each other and thus produce higher gain
  878. when both are activated.
  879. @item fscale
  880. Set frequency scale used to draw frequency response in video output.
  881. Can be linear or logarithmic. Default is logarithmic.
  882. @item colors
  883. Set color for each channel curve which is going to be displayed in video stream.
  884. This is list of color names separated by space or by '|'.
  885. Unrecognised or missing colors will be replaced by white color.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  891. for first 2 channels using Chebyshev type 1 filter:
  892. @example
  893. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  894. @end example
  895. @end itemize
  896. @subsection Commands
  897. This filter supports the following commands:
  898. @table @option
  899. @item change
  900. Alter existing filter parameters.
  901. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  902. @var{fN} is existing filter number, starting from 0, if no such filter is available
  903. error is returned.
  904. @var{freq} set new frequency parameter.
  905. @var{width} set new width parameter in herz.
  906. @var{gain} set new gain parameter in dB.
  907. Full filter invocation with asendcmd may look like this:
  908. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  909. @end table
  910. @section anull
  911. Pass the audio source unchanged to the output.
  912. @section apad
  913. Pad the end of an audio stream with silence.
  914. This can be used together with @command{ffmpeg} @option{-shortest} to
  915. extend audio streams to the same length as the video stream.
  916. A description of the accepted options follows.
  917. @table @option
  918. @item packet_size
  919. Set silence packet size. Default value is 4096.
  920. @item pad_len
  921. Set the number of samples of silence to add to the end. After the
  922. value is reached, the stream is terminated. This option is mutually
  923. exclusive with @option{whole_len}.
  924. @item whole_len
  925. Set the minimum total number of samples in the output audio stream. If
  926. the value is longer than the input audio length, silence is added to
  927. the end, until the value is reached. This option is mutually exclusive
  928. with @option{pad_len}.
  929. @end table
  930. If neither the @option{pad_len} nor the @option{whole_len} option is
  931. set, the filter will add silence to the end of the input stream
  932. indefinitely.
  933. @subsection Examples
  934. @itemize
  935. @item
  936. Add 1024 samples of silence to the end of the input:
  937. @example
  938. apad=pad_len=1024
  939. @end example
  940. @item
  941. Make sure the audio output will contain at least 10000 samples, pad
  942. the input with silence if required:
  943. @example
  944. apad=whole_len=10000
  945. @end example
  946. @item
  947. Use @command{ffmpeg} to pad the audio input with silence, so that the
  948. video stream will always result the shortest and will be converted
  949. until the end in the output file when using the @option{shortest}
  950. option:
  951. @example
  952. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  953. @end example
  954. @end itemize
  955. @section aphaser
  956. Add a phasing effect to the input audio.
  957. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  958. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  959. A description of the accepted parameters follows.
  960. @table @option
  961. @item in_gain
  962. Set input gain. Default is 0.4.
  963. @item out_gain
  964. Set output gain. Default is 0.74
  965. @item delay
  966. Set delay in milliseconds. Default is 3.0.
  967. @item decay
  968. Set decay. Default is 0.4.
  969. @item speed
  970. Set modulation speed in Hz. Default is 0.5.
  971. @item type
  972. Set modulation type. Default is triangular.
  973. It accepts the following values:
  974. @table @samp
  975. @item triangular, t
  976. @item sinusoidal, s
  977. @end table
  978. @end table
  979. @section apulsator
  980. Audio pulsator is something between an autopanner and a tremolo.
  981. But it can produce funny stereo effects as well. Pulsator changes the volume
  982. of the left and right channel based on a LFO (low frequency oscillator) with
  983. different waveforms and shifted phases.
  984. This filter have the ability to define an offset between left and right
  985. channel. An offset of 0 means that both LFO shapes match each other.
  986. The left and right channel are altered equally - a conventional tremolo.
  987. An offset of 50% means that the shape of the right channel is exactly shifted
  988. in phase (or moved backwards about half of the frequency) - pulsator acts as
  989. an autopanner. At 1 both curves match again. Every setting in between moves the
  990. phase shift gapless between all stages and produces some "bypassing" sounds with
  991. sine and triangle waveforms. The more you set the offset near 1 (starting from
  992. the 0.5) the faster the signal passes from the left to the right speaker.
  993. The filter accepts the following options:
  994. @table @option
  995. @item level_in
  996. Set input gain. By default it is 1. Range is [0.015625 - 64].
  997. @item level_out
  998. Set output gain. By default it is 1. Range is [0.015625 - 64].
  999. @item mode
  1000. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1001. sawup or sawdown. Default is sine.
  1002. @item amount
  1003. Set modulation. Define how much of original signal is affected by the LFO.
  1004. @item offset_l
  1005. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1006. @item offset_r
  1007. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1008. @item width
  1009. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1010. @item timing
  1011. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1012. @item bpm
  1013. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1014. is set to bpm.
  1015. @item ms
  1016. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1017. is set to ms.
  1018. @item hz
  1019. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1020. if timing is set to hz.
  1021. @end table
  1022. @anchor{aresample}
  1023. @section aresample
  1024. Resample the input audio to the specified parameters, using the
  1025. libswresample library. If none are specified then the filter will
  1026. automatically convert between its input and output.
  1027. This filter is also able to stretch/squeeze the audio data to make it match
  1028. the timestamps or to inject silence / cut out audio to make it match the
  1029. timestamps, do a combination of both or do neither.
  1030. The filter accepts the syntax
  1031. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1032. expresses a sample rate and @var{resampler_options} is a list of
  1033. @var{key}=@var{value} pairs, separated by ":". See the
  1034. ffmpeg-resampler manual for the complete list of supported options.
  1035. @subsection Examples
  1036. @itemize
  1037. @item
  1038. Resample the input audio to 44100Hz:
  1039. @example
  1040. aresample=44100
  1041. @end example
  1042. @item
  1043. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1044. samples per second compensation:
  1045. @example
  1046. aresample=async=1000
  1047. @end example
  1048. @end itemize
  1049. @section asetnsamples
  1050. Set the number of samples per each output audio frame.
  1051. The last output packet may contain a different number of samples, as
  1052. the filter will flush all the remaining samples when the input audio
  1053. signals its end.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item nb_out_samples, n
  1057. Set the number of frames per each output audio frame. The number is
  1058. intended as the number of samples @emph{per each channel}.
  1059. Default value is 1024.
  1060. @item pad, p
  1061. If set to 1, the filter will pad the last audio frame with zeroes, so
  1062. that the last frame will contain the same number of samples as the
  1063. previous ones. Default value is 1.
  1064. @end table
  1065. For example, to set the number of per-frame samples to 1234 and
  1066. disable padding for the last frame, use:
  1067. @example
  1068. asetnsamples=n=1234:p=0
  1069. @end example
  1070. @section asetrate
  1071. Set the sample rate without altering the PCM data.
  1072. This will result in a change of speed and pitch.
  1073. The filter accepts the following options:
  1074. @table @option
  1075. @item sample_rate, r
  1076. Set the output sample rate. Default is 44100 Hz.
  1077. @end table
  1078. @section ashowinfo
  1079. Show a line containing various information for each input audio frame.
  1080. The input audio is not modified.
  1081. The shown line contains a sequence of key/value pairs of the form
  1082. @var{key}:@var{value}.
  1083. The following values are shown in the output:
  1084. @table @option
  1085. @item n
  1086. The (sequential) number of the input frame, starting from 0.
  1087. @item pts
  1088. The presentation timestamp of the input frame, in time base units; the time base
  1089. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1090. @item pts_time
  1091. The presentation timestamp of the input frame in seconds.
  1092. @item pos
  1093. position of the frame in the input stream, -1 if this information in
  1094. unavailable and/or meaningless (for example in case of synthetic audio)
  1095. @item fmt
  1096. The sample format.
  1097. @item chlayout
  1098. The channel layout.
  1099. @item rate
  1100. The sample rate for the audio frame.
  1101. @item nb_samples
  1102. The number of samples (per channel) in the frame.
  1103. @item checksum
  1104. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1105. audio, the data is treated as if all the planes were concatenated.
  1106. @item plane_checksums
  1107. A list of Adler-32 checksums for each data plane.
  1108. @end table
  1109. @anchor{astats}
  1110. @section astats
  1111. Display time domain statistical information about the audio channels.
  1112. Statistics are calculated and displayed for each audio channel and,
  1113. where applicable, an overall figure is also given.
  1114. It accepts the following option:
  1115. @table @option
  1116. @item length
  1117. Short window length in seconds, used for peak and trough RMS measurement.
  1118. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1119. @item metadata
  1120. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1121. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1122. disabled.
  1123. Available keys for each channel are:
  1124. DC_offset
  1125. Min_level
  1126. Max_level
  1127. Min_difference
  1128. Max_difference
  1129. Mean_difference
  1130. Peak_level
  1131. RMS_peak
  1132. RMS_trough
  1133. Crest_factor
  1134. Flat_factor
  1135. Peak_count
  1136. Bit_depth
  1137. and for Overall:
  1138. DC_offset
  1139. Min_level
  1140. Max_level
  1141. Min_difference
  1142. Max_difference
  1143. Mean_difference
  1144. Peak_level
  1145. RMS_level
  1146. RMS_peak
  1147. RMS_trough
  1148. Flat_factor
  1149. Peak_count
  1150. Bit_depth
  1151. Number_of_samples
  1152. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1153. this @code{lavfi.astats.Overall.Peak_count}.
  1154. For description what each key means read below.
  1155. @item reset
  1156. Set number of frame after which stats are going to be recalculated.
  1157. Default is disabled.
  1158. @end table
  1159. A description of each shown parameter follows:
  1160. @table @option
  1161. @item DC offset
  1162. Mean amplitude displacement from zero.
  1163. @item Min level
  1164. Minimal sample level.
  1165. @item Max level
  1166. Maximal sample level.
  1167. @item Min difference
  1168. Minimal difference between two consecutive samples.
  1169. @item Max difference
  1170. Maximal difference between two consecutive samples.
  1171. @item Mean difference
  1172. Mean difference between two consecutive samples.
  1173. The average of each difference between two consecutive samples.
  1174. @item Peak level dB
  1175. @item RMS level dB
  1176. Standard peak and RMS level measured in dBFS.
  1177. @item RMS peak dB
  1178. @item RMS trough dB
  1179. Peak and trough values for RMS level measured over a short window.
  1180. @item Crest factor
  1181. Standard ratio of peak to RMS level (note: not in dB).
  1182. @item Flat factor
  1183. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1184. (i.e. either @var{Min level} or @var{Max level}).
  1185. @item Peak count
  1186. Number of occasions (not the number of samples) that the signal attained either
  1187. @var{Min level} or @var{Max level}.
  1188. @item Bit depth
  1189. Overall bit depth of audio. Number of bits used for each sample.
  1190. @end table
  1191. @section asyncts
  1192. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1193. dropping samples/adding silence when needed.
  1194. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1195. It accepts the following parameters:
  1196. @table @option
  1197. @item compensate
  1198. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1199. by default. When disabled, time gaps are covered with silence.
  1200. @item min_delta
  1201. The minimum difference between timestamps and audio data (in seconds) to trigger
  1202. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1203. sync with this filter, try setting this parameter to 0.
  1204. @item max_comp
  1205. The maximum compensation in samples per second. Only relevant with compensate=1.
  1206. The default value is 500.
  1207. @item first_pts
  1208. Assume that the first PTS should be this value. The time base is 1 / sample
  1209. rate. This allows for padding/trimming at the start of the stream. By default,
  1210. no assumption is made about the first frame's expected PTS, so no padding or
  1211. trimming is done. For example, this could be set to 0 to pad the beginning with
  1212. silence if an audio stream starts after the video stream or to trim any samples
  1213. with a negative PTS due to encoder delay.
  1214. @end table
  1215. @section atempo
  1216. Adjust audio tempo.
  1217. The filter accepts exactly one parameter, the audio tempo. If not
  1218. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1219. be in the [0.5, 2.0] range.
  1220. @subsection Examples
  1221. @itemize
  1222. @item
  1223. Slow down audio to 80% tempo:
  1224. @example
  1225. atempo=0.8
  1226. @end example
  1227. @item
  1228. To speed up audio to 125% tempo:
  1229. @example
  1230. atempo=1.25
  1231. @end example
  1232. @end itemize
  1233. @section atrim
  1234. Trim the input so that the output contains one continuous subpart of the input.
  1235. It accepts the following parameters:
  1236. @table @option
  1237. @item start
  1238. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1239. sample with the timestamp @var{start} will be the first sample in the output.
  1240. @item end
  1241. Specify time of the first audio sample that will be dropped, i.e. the
  1242. audio sample immediately preceding the one with the timestamp @var{end} will be
  1243. the last sample in the output.
  1244. @item start_pts
  1245. Same as @var{start}, except this option sets the start timestamp in samples
  1246. instead of seconds.
  1247. @item end_pts
  1248. Same as @var{end}, except this option sets the end timestamp in samples instead
  1249. of seconds.
  1250. @item duration
  1251. The maximum duration of the output in seconds.
  1252. @item start_sample
  1253. The number of the first sample that should be output.
  1254. @item end_sample
  1255. The number of the first sample that should be dropped.
  1256. @end table
  1257. @option{start}, @option{end}, and @option{duration} are expressed as time
  1258. duration specifications; see
  1259. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1260. Note that the first two sets of the start/end options and the @option{duration}
  1261. option look at the frame timestamp, while the _sample options simply count the
  1262. samples that pass through the filter. So start/end_pts and start/end_sample will
  1263. give different results when the timestamps are wrong, inexact or do not start at
  1264. zero. Also note that this filter does not modify the timestamps. If you wish
  1265. to have the output timestamps start at zero, insert the asetpts filter after the
  1266. atrim filter.
  1267. If multiple start or end options are set, this filter tries to be greedy and
  1268. keep all samples that match at least one of the specified constraints. To keep
  1269. only the part that matches all the constraints at once, chain multiple atrim
  1270. filters.
  1271. The defaults are such that all the input is kept. So it is possible to set e.g.
  1272. just the end values to keep everything before the specified time.
  1273. Examples:
  1274. @itemize
  1275. @item
  1276. Drop everything except the second minute of input:
  1277. @example
  1278. ffmpeg -i INPUT -af atrim=60:120
  1279. @end example
  1280. @item
  1281. Keep only the first 1000 samples:
  1282. @example
  1283. ffmpeg -i INPUT -af atrim=end_sample=1000
  1284. @end example
  1285. @end itemize
  1286. @section bandpass
  1287. Apply a two-pole Butterworth band-pass filter with central
  1288. frequency @var{frequency}, and (3dB-point) band-width width.
  1289. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1290. instead of the default: constant 0dB peak gain.
  1291. The filter roll off at 6dB per octave (20dB per decade).
  1292. The filter accepts the following options:
  1293. @table @option
  1294. @item frequency, f
  1295. Set the filter's central frequency. Default is @code{3000}.
  1296. @item csg
  1297. Constant skirt gain if set to 1. Defaults to 0.
  1298. @item width_type
  1299. Set method to specify band-width of filter.
  1300. @table @option
  1301. @item h
  1302. Hz
  1303. @item q
  1304. Q-Factor
  1305. @item o
  1306. octave
  1307. @item s
  1308. slope
  1309. @end table
  1310. @item width, w
  1311. Specify the band-width of a filter in width_type units.
  1312. @end table
  1313. @section bandreject
  1314. Apply a two-pole Butterworth band-reject filter with central
  1315. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1316. The filter roll off at 6dB per octave (20dB per decade).
  1317. The filter accepts the following options:
  1318. @table @option
  1319. @item frequency, f
  1320. Set the filter's central frequency. Default is @code{3000}.
  1321. @item width_type
  1322. Set method to specify band-width of filter.
  1323. @table @option
  1324. @item h
  1325. Hz
  1326. @item q
  1327. Q-Factor
  1328. @item o
  1329. octave
  1330. @item s
  1331. slope
  1332. @end table
  1333. @item width, w
  1334. Specify the band-width of a filter in width_type units.
  1335. @end table
  1336. @section bass
  1337. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1338. shelving filter with a response similar to that of a standard
  1339. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1340. The filter accepts the following options:
  1341. @table @option
  1342. @item gain, g
  1343. Give the gain at 0 Hz. Its useful range is about -20
  1344. (for a large cut) to +20 (for a large boost).
  1345. Beware of clipping when using a positive gain.
  1346. @item frequency, f
  1347. Set the filter's central frequency and so can be used
  1348. to extend or reduce the frequency range to be boosted or cut.
  1349. The default value is @code{100} Hz.
  1350. @item width_type
  1351. Set method to specify band-width of filter.
  1352. @table @option
  1353. @item h
  1354. Hz
  1355. @item q
  1356. Q-Factor
  1357. @item o
  1358. octave
  1359. @item s
  1360. slope
  1361. @end table
  1362. @item width, w
  1363. Determine how steep is the filter's shelf transition.
  1364. @end table
  1365. @section biquad
  1366. Apply a biquad IIR filter with the given coefficients.
  1367. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1368. are the numerator and denominator coefficients respectively.
  1369. @section bs2b
  1370. Bauer stereo to binaural transformation, which improves headphone listening of
  1371. stereo audio records.
  1372. It accepts the following parameters:
  1373. @table @option
  1374. @item profile
  1375. Pre-defined crossfeed level.
  1376. @table @option
  1377. @item default
  1378. Default level (fcut=700, feed=50).
  1379. @item cmoy
  1380. Chu Moy circuit (fcut=700, feed=60).
  1381. @item jmeier
  1382. Jan Meier circuit (fcut=650, feed=95).
  1383. @end table
  1384. @item fcut
  1385. Cut frequency (in Hz).
  1386. @item feed
  1387. Feed level (in Hz).
  1388. @end table
  1389. @section channelmap
  1390. Remap input channels to new locations.
  1391. It accepts the following parameters:
  1392. @table @option
  1393. @item channel_layout
  1394. The channel layout of the output stream.
  1395. @item map
  1396. Map channels from input to output. The argument is a '|'-separated list of
  1397. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1398. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1399. channel (e.g. FL for front left) or its index in the input channel layout.
  1400. @var{out_channel} is the name of the output channel or its index in the output
  1401. channel layout. If @var{out_channel} is not given then it is implicitly an
  1402. index, starting with zero and increasing by one for each mapping.
  1403. @end table
  1404. If no mapping is present, the filter will implicitly map input channels to
  1405. output channels, preserving indices.
  1406. For example, assuming a 5.1+downmix input MOV file,
  1407. @example
  1408. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1409. @end example
  1410. will create an output WAV file tagged as stereo from the downmix channels of
  1411. the input.
  1412. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1413. @example
  1414. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1415. @end example
  1416. @section channelsplit
  1417. Split each channel from an input audio stream into a separate output stream.
  1418. It accepts the following parameters:
  1419. @table @option
  1420. @item channel_layout
  1421. The channel layout of the input stream. The default is "stereo".
  1422. @end table
  1423. For example, assuming a stereo input MP3 file,
  1424. @example
  1425. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1426. @end example
  1427. will create an output Matroska file with two audio streams, one containing only
  1428. the left channel and the other the right channel.
  1429. Split a 5.1 WAV file into per-channel files:
  1430. @example
  1431. ffmpeg -i in.wav -filter_complex
  1432. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1433. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1434. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1435. side_right.wav
  1436. @end example
  1437. @section chorus
  1438. Add a chorus effect to the audio.
  1439. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1440. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1441. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1442. The modulation depth defines the range the modulated delay is played before or after
  1443. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1444. sound tuned around the original one, like in a chorus where some vocals are slightly
  1445. off key.
  1446. It accepts the following parameters:
  1447. @table @option
  1448. @item in_gain
  1449. Set input gain. Default is 0.4.
  1450. @item out_gain
  1451. Set output gain. Default is 0.4.
  1452. @item delays
  1453. Set delays. A typical delay is around 40ms to 60ms.
  1454. @item decays
  1455. Set decays.
  1456. @item speeds
  1457. Set speeds.
  1458. @item depths
  1459. Set depths.
  1460. @end table
  1461. @subsection Examples
  1462. @itemize
  1463. @item
  1464. A single delay:
  1465. @example
  1466. chorus=0.7:0.9:55:0.4:0.25:2
  1467. @end example
  1468. @item
  1469. Two delays:
  1470. @example
  1471. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1472. @end example
  1473. @item
  1474. Fuller sounding chorus with three delays:
  1475. @example
  1476. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  1477. @end example
  1478. @end itemize
  1479. @section compand
  1480. Compress or expand the audio's dynamic range.
  1481. It accepts the following parameters:
  1482. @table @option
  1483. @item attacks
  1484. @item decays
  1485. A list of times in seconds for each channel over which the instantaneous level
  1486. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1487. increase of volume and @var{decays} refers to decrease of volume. For most
  1488. situations, the attack time (response to the audio getting louder) should be
  1489. shorter than the decay time, because the human ear is more sensitive to sudden
  1490. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1491. a typical value for decay is 0.8 seconds.
  1492. If specified number of attacks & decays is lower than number of channels, the last
  1493. set attack/decay will be used for all remaining channels.
  1494. @item points
  1495. A list of points for the transfer function, specified in dB relative to the
  1496. maximum possible signal amplitude. Each key points list must be defined using
  1497. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1498. @code{x0/y0 x1/y1 x2/y2 ....}
  1499. The input values must be in strictly increasing order but the transfer function
  1500. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1501. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1502. function are @code{-70/-70|-60/-20}.
  1503. @item soft-knee
  1504. Set the curve radius in dB for all joints. It defaults to 0.01.
  1505. @item gain
  1506. Set the additional gain in dB to be applied at all points on the transfer
  1507. function. This allows for easy adjustment of the overall gain.
  1508. It defaults to 0.
  1509. @item volume
  1510. Set an initial volume, in dB, to be assumed for each channel when filtering
  1511. starts. This permits the user to supply a nominal level initially, so that, for
  1512. example, a very large gain is not applied to initial signal levels before the
  1513. companding has begun to operate. A typical value for audio which is initially
  1514. quiet is -90 dB. It defaults to 0.
  1515. @item delay
  1516. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1517. delayed before being fed to the volume adjuster. Specifying a delay
  1518. approximately equal to the attack/decay times allows the filter to effectively
  1519. operate in predictive rather than reactive mode. It defaults to 0.
  1520. @end table
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Make music with both quiet and loud passages suitable for listening to in a
  1525. noisy environment:
  1526. @example
  1527. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1528. @end example
  1529. Another example for audio with whisper and explosion parts:
  1530. @example
  1531. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1532. @end example
  1533. @item
  1534. A noise gate for when the noise is at a lower level than the signal:
  1535. @example
  1536. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1537. @end example
  1538. @item
  1539. Here is another noise gate, this time for when the noise is at a higher level
  1540. than the signal (making it, in some ways, similar to squelch):
  1541. @example
  1542. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1543. @end example
  1544. @item
  1545. 2:1 compression starting at -6dB:
  1546. @example
  1547. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1548. @end example
  1549. @item
  1550. 2:1 compression starting at -9dB:
  1551. @example
  1552. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1553. @end example
  1554. @item
  1555. 2:1 compression starting at -12dB:
  1556. @example
  1557. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1558. @end example
  1559. @item
  1560. 2:1 compression starting at -18dB:
  1561. @example
  1562. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1563. @end example
  1564. @item
  1565. 3:1 compression starting at -15dB:
  1566. @example
  1567. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1568. @end example
  1569. @item
  1570. Compressor/Gate:
  1571. @example
  1572. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1573. @end example
  1574. @item
  1575. Expander:
  1576. @example
  1577. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  1578. @end example
  1579. @item
  1580. Hard limiter at -6dB:
  1581. @example
  1582. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1583. @end example
  1584. @item
  1585. Hard limiter at -12dB:
  1586. @example
  1587. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1588. @end example
  1589. @item
  1590. Hard noise gate at -35 dB:
  1591. @example
  1592. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1593. @end example
  1594. @item
  1595. Soft limiter:
  1596. @example
  1597. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1598. @end example
  1599. @end itemize
  1600. @section compensationdelay
  1601. Compensation Delay Line is a metric based delay to compensate differing
  1602. positions of microphones or speakers.
  1603. For example, you have recorded guitar with two microphones placed in
  1604. different location. Because the front of sound wave has fixed speed in
  1605. normal conditions, the phasing of microphones can vary and depends on
  1606. their location and interposition. The best sound mix can be achieved when
  1607. these microphones are in phase (synchronized). Note that distance of
  1608. ~30 cm between microphones makes one microphone to capture signal in
  1609. antiphase to another microphone. That makes the final mix sounding moody.
  1610. This filter helps to solve phasing problems by adding different delays
  1611. to each microphone track and make them synchronized.
  1612. The best result can be reached when you take one track as base and
  1613. synchronize other tracks one by one with it.
  1614. Remember that synchronization/delay tolerance depends on sample rate, too.
  1615. Higher sample rates will give more tolerance.
  1616. It accepts the following parameters:
  1617. @table @option
  1618. @item mm
  1619. Set millimeters distance. This is compensation distance for fine tuning.
  1620. Default is 0.
  1621. @item cm
  1622. Set cm distance. This is compensation distance for tightening distance setup.
  1623. Default is 0.
  1624. @item m
  1625. Set meters distance. This is compensation distance for hard distance setup.
  1626. Default is 0.
  1627. @item dry
  1628. Set dry amount. Amount of unprocessed (dry) signal.
  1629. Default is 0.
  1630. @item wet
  1631. Set wet amount. Amount of processed (wet) signal.
  1632. Default is 1.
  1633. @item temp
  1634. Set temperature degree in Celsius. This is the temperature of the environment.
  1635. Default is 20.
  1636. @end table
  1637. @section dcshift
  1638. Apply a DC shift to the audio.
  1639. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1640. in the recording chain) from the audio. The effect of a DC offset is reduced
  1641. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1642. a signal has a DC offset.
  1643. @table @option
  1644. @item shift
  1645. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1646. the audio.
  1647. @item limitergain
  1648. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1649. used to prevent clipping.
  1650. @end table
  1651. @section dynaudnorm
  1652. Dynamic Audio Normalizer.
  1653. This filter applies a certain amount of gain to the input audio in order
  1654. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1655. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1656. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1657. This allows for applying extra gain to the "quiet" sections of the audio
  1658. while avoiding distortions or clipping the "loud" sections. In other words:
  1659. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1660. sections, in the sense that the volume of each section is brought to the
  1661. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1662. this goal *without* applying "dynamic range compressing". It will retain 100%
  1663. of the dynamic range *within* each section of the audio file.
  1664. @table @option
  1665. @item f
  1666. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1667. Default is 500 milliseconds.
  1668. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1669. referred to as frames. This is required, because a peak magnitude has no
  1670. meaning for just a single sample value. Instead, we need to determine the
  1671. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1672. normalizer would simply use the peak magnitude of the complete file, the
  1673. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1674. frame. The length of a frame is specified in milliseconds. By default, the
  1675. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1676. been found to give good results with most files.
  1677. Note that the exact frame length, in number of samples, will be determined
  1678. automatically, based on the sampling rate of the individual input audio file.
  1679. @item g
  1680. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1681. number. Default is 31.
  1682. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1683. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1684. is specified in frames, centered around the current frame. For the sake of
  1685. simplicity, this must be an odd number. Consequently, the default value of 31
  1686. takes into account the current frame, as well as the 15 preceding frames and
  1687. the 15 subsequent frames. Using a larger window results in a stronger
  1688. smoothing effect and thus in less gain variation, i.e. slower gain
  1689. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1690. effect and thus in more gain variation, i.e. faster gain adaptation.
  1691. In other words, the more you increase this value, the more the Dynamic Audio
  1692. Normalizer will behave like a "traditional" normalization filter. On the
  1693. contrary, the more you decrease this value, the more the Dynamic Audio
  1694. Normalizer will behave like a dynamic range compressor.
  1695. @item p
  1696. Set the target peak value. This specifies the highest permissible magnitude
  1697. level for the normalized audio input. This filter will try to approach the
  1698. target peak magnitude as closely as possible, but at the same time it also
  1699. makes sure that the normalized signal will never exceed the peak magnitude.
  1700. A frame's maximum local gain factor is imposed directly by the target peak
  1701. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1702. It is not recommended to go above this value.
  1703. @item m
  1704. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1705. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1706. factor for each input frame, i.e. the maximum gain factor that does not
  1707. result in clipping or distortion. The maximum gain factor is determined by
  1708. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1709. additionally bounds the frame's maximum gain factor by a predetermined
  1710. (global) maximum gain factor. This is done in order to avoid excessive gain
  1711. factors in "silent" or almost silent frames. By default, the maximum gain
  1712. factor is 10.0, For most inputs the default value should be sufficient and
  1713. it usually is not recommended to increase this value. Though, for input
  1714. with an extremely low overall volume level, it may be necessary to allow even
  1715. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1716. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1717. Instead, a "sigmoid" threshold function will be applied. This way, the
  1718. gain factors will smoothly approach the threshold value, but never exceed that
  1719. value.
  1720. @item r
  1721. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1722. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1723. This means that the maximum local gain factor for each frame is defined
  1724. (only) by the frame's highest magnitude sample. This way, the samples can
  1725. be amplified as much as possible without exceeding the maximum signal
  1726. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1727. Normalizer can also take into account the frame's root mean square,
  1728. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1729. determine the power of a time-varying signal. It is therefore considered
  1730. that the RMS is a better approximation of the "perceived loudness" than
  1731. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1732. frames to a constant RMS value, a uniform "perceived loudness" can be
  1733. established. If a target RMS value has been specified, a frame's local gain
  1734. factor is defined as the factor that would result in exactly that RMS value.
  1735. Note, however, that the maximum local gain factor is still restricted by the
  1736. frame's highest magnitude sample, in order to prevent clipping.
  1737. @item n
  1738. Enable channels coupling. By default is enabled.
  1739. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1740. amount. This means the same gain factor will be applied to all channels, i.e.
  1741. the maximum possible gain factor is determined by the "loudest" channel.
  1742. However, in some recordings, it may happen that the volume of the different
  1743. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1744. In this case, this option can be used to disable the channel coupling. This way,
  1745. the gain factor will be determined independently for each channel, depending
  1746. only on the individual channel's highest magnitude sample. This allows for
  1747. harmonizing the volume of the different channels.
  1748. @item c
  1749. Enable DC bias correction. By default is disabled.
  1750. An audio signal (in the time domain) is a sequence of sample values.
  1751. In the Dynamic Audio Normalizer these sample values are represented in the
  1752. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1753. audio signal, or "waveform", should be centered around the zero point.
  1754. That means if we calculate the mean value of all samples in a file, or in a
  1755. single frame, then the result should be 0.0 or at least very close to that
  1756. value. If, however, there is a significant deviation of the mean value from
  1757. 0.0, in either positive or negative direction, this is referred to as a
  1758. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1759. Audio Normalizer provides optional DC bias correction.
  1760. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1761. the mean value, or "DC correction" offset, of each input frame and subtract
  1762. that value from all of the frame's sample values which ensures those samples
  1763. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1764. boundaries, the DC correction offset values will be interpolated smoothly
  1765. between neighbouring frames.
  1766. @item b
  1767. Enable alternative boundary mode. By default is disabled.
  1768. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1769. around each frame. This includes the preceding frames as well as the
  1770. subsequent frames. However, for the "boundary" frames, located at the very
  1771. beginning and at the very end of the audio file, not all neighbouring
  1772. frames are available. In particular, for the first few frames in the audio
  1773. file, the preceding frames are not known. And, similarly, for the last few
  1774. frames in the audio file, the subsequent frames are not known. Thus, the
  1775. question arises which gain factors should be assumed for the missing frames
  1776. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1777. to deal with this situation. The default boundary mode assumes a gain factor
  1778. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1779. "fade out" at the beginning and at the end of the input, respectively.
  1780. @item s
  1781. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1782. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1783. compression. This means that signal peaks will not be pruned and thus the
  1784. full dynamic range will be retained within each local neighbourhood. However,
  1785. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1786. normalization algorithm with a more "traditional" compression.
  1787. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1788. (thresholding) function. If (and only if) the compression feature is enabled,
  1789. all input frames will be processed by a soft knee thresholding function prior
  1790. to the actual normalization process. Put simply, the thresholding function is
  1791. going to prune all samples whose magnitude exceeds a certain threshold value.
  1792. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1793. value. Instead, the threshold value will be adjusted for each individual
  1794. frame.
  1795. In general, smaller parameters result in stronger compression, and vice versa.
  1796. Values below 3.0 are not recommended, because audible distortion may appear.
  1797. @end table
  1798. @section earwax
  1799. Make audio easier to listen to on headphones.
  1800. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1801. so that when listened to on headphones the stereo image is moved from
  1802. inside your head (standard for headphones) to outside and in front of
  1803. the listener (standard for speakers).
  1804. Ported from SoX.
  1805. @section equalizer
  1806. Apply a two-pole peaking equalisation (EQ) filter. With this
  1807. filter, the signal-level at and around a selected frequency can
  1808. be increased or decreased, whilst (unlike bandpass and bandreject
  1809. filters) that at all other frequencies is unchanged.
  1810. In order to produce complex equalisation curves, this filter can
  1811. be given several times, each with a different central frequency.
  1812. The filter accepts the following options:
  1813. @table @option
  1814. @item frequency, f
  1815. Set the filter's central frequency in Hz.
  1816. @item width_type
  1817. Set method to specify band-width of filter.
  1818. @table @option
  1819. @item h
  1820. Hz
  1821. @item q
  1822. Q-Factor
  1823. @item o
  1824. octave
  1825. @item s
  1826. slope
  1827. @end table
  1828. @item width, w
  1829. Specify the band-width of a filter in width_type units.
  1830. @item gain, g
  1831. Set the required gain or attenuation in dB.
  1832. Beware of clipping when using a positive gain.
  1833. @end table
  1834. @subsection Examples
  1835. @itemize
  1836. @item
  1837. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1838. @example
  1839. equalizer=f=1000:width_type=h:width=200:g=-10
  1840. @end example
  1841. @item
  1842. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1843. @example
  1844. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1845. @end example
  1846. @end itemize
  1847. @section extrastereo
  1848. Linearly increases the difference between left and right channels which
  1849. adds some sort of "live" effect to playback.
  1850. The filter accepts the following option:
  1851. @table @option
  1852. @item m
  1853. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1854. (average of both channels), with 1.0 sound will be unchanged, with
  1855. -1.0 left and right channels will be swapped.
  1856. @item c
  1857. Enable clipping. By default is enabled.
  1858. @end table
  1859. @section firequalizer
  1860. Apply FIR Equalization using arbitrary frequency response.
  1861. The filter accepts the following option:
  1862. @table @option
  1863. @item gain
  1864. Set gain curve equation (in dB). The expression can contain variables:
  1865. @table @option
  1866. @item f
  1867. the evaluated frequency
  1868. @item sr
  1869. sample rate
  1870. @item ch
  1871. channel number, set to 0 when multichannels evaluation is disabled
  1872. @item chid
  1873. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1874. multichannels evaluation is disabled
  1875. @item chs
  1876. number of channels
  1877. @item chlayout
  1878. channel_layout, see libavutil/channel_layout.h
  1879. @end table
  1880. and functions:
  1881. @table @option
  1882. @item gain_interpolate(f)
  1883. interpolate gain on frequency f based on gain_entry
  1884. @end table
  1885. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1886. @item gain_entry
  1887. Set gain entry for gain_interpolate function. The expression can
  1888. contain functions:
  1889. @table @option
  1890. @item entry(f, g)
  1891. store gain entry at frequency f with value g
  1892. @end table
  1893. This option is also available as command.
  1894. @item delay
  1895. Set filter delay in seconds. Higher value means more accurate.
  1896. Default is @code{0.01}.
  1897. @item accuracy
  1898. Set filter accuracy in Hz. Lower value means more accurate.
  1899. Default is @code{5}.
  1900. @item wfunc
  1901. Set window function. Acceptable values are:
  1902. @table @option
  1903. @item rectangular
  1904. rectangular window, useful when gain curve is already smooth
  1905. @item hann
  1906. hann window (default)
  1907. @item hamming
  1908. hamming window
  1909. @item blackman
  1910. blackman window
  1911. @item nuttall3
  1912. 3-terms continuous 1st derivative nuttall window
  1913. @item mnuttall3
  1914. minimum 3-terms discontinuous nuttall window
  1915. @item nuttall
  1916. 4-terms continuous 1st derivative nuttall window
  1917. @item bnuttall
  1918. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  1919. @item bharris
  1920. blackman-harris window
  1921. @end table
  1922. @item fixed
  1923. If enabled, use fixed number of audio samples. This improves speed when
  1924. filtering with large delay. Default is disabled.
  1925. @item multi
  1926. Enable multichannels evaluation on gain. Default is disabled.
  1927. @item zero_phase
  1928. Enable zero phase mode by subtracting timestamp to compensate delay.
  1929. Default is disabled.
  1930. @end table
  1931. @subsection Examples
  1932. @itemize
  1933. @item
  1934. lowpass at 1000 Hz:
  1935. @example
  1936. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  1937. @end example
  1938. @item
  1939. lowpass at 1000 Hz with gain_entry:
  1940. @example
  1941. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  1942. @end example
  1943. @item
  1944. custom equalization:
  1945. @example
  1946. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  1947. @end example
  1948. @item
  1949. higher delay with zero phase to compensate delay:
  1950. @example
  1951. firequalizer=delay=0.1:fixed=on:zero_phase=on
  1952. @end example
  1953. @item
  1954. lowpass on left channel, highpass on right channel:
  1955. @example
  1956. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  1957. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  1958. @end example
  1959. @end itemize
  1960. @section flanger
  1961. Apply a flanging effect to the audio.
  1962. The filter accepts the following options:
  1963. @table @option
  1964. @item delay
  1965. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1966. @item depth
  1967. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1968. @item regen
  1969. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1970. Default value is 0.
  1971. @item width
  1972. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1973. Default value is 71.
  1974. @item speed
  1975. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1976. @item shape
  1977. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1978. Default value is @var{sinusoidal}.
  1979. @item phase
  1980. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1981. Default value is 25.
  1982. @item interp
  1983. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1984. Default is @var{linear}.
  1985. @end table
  1986. @section highpass
  1987. Apply a high-pass filter with 3dB point frequency.
  1988. The filter can be either single-pole, or double-pole (the default).
  1989. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1990. The filter accepts the following options:
  1991. @table @option
  1992. @item frequency, f
  1993. Set frequency in Hz. Default is 3000.
  1994. @item poles, p
  1995. Set number of poles. Default is 2.
  1996. @item width_type
  1997. Set method to specify band-width of filter.
  1998. @table @option
  1999. @item h
  2000. Hz
  2001. @item q
  2002. Q-Factor
  2003. @item o
  2004. octave
  2005. @item s
  2006. slope
  2007. @end table
  2008. @item width, w
  2009. Specify the band-width of a filter in width_type units.
  2010. Applies only to double-pole filter.
  2011. The default is 0.707q and gives a Butterworth response.
  2012. @end table
  2013. @section join
  2014. Join multiple input streams into one multi-channel stream.
  2015. It accepts the following parameters:
  2016. @table @option
  2017. @item inputs
  2018. The number of input streams. It defaults to 2.
  2019. @item channel_layout
  2020. The desired output channel layout. It defaults to stereo.
  2021. @item map
  2022. Map channels from inputs to output. The argument is a '|'-separated list of
  2023. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2024. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2025. can be either the name of the input channel (e.g. FL for front left) or its
  2026. index in the specified input stream. @var{out_channel} is the name of the output
  2027. channel.
  2028. @end table
  2029. The filter will attempt to guess the mappings when they are not specified
  2030. explicitly. It does so by first trying to find an unused matching input channel
  2031. and if that fails it picks the first unused input channel.
  2032. Join 3 inputs (with properly set channel layouts):
  2033. @example
  2034. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2035. @end example
  2036. Build a 5.1 output from 6 single-channel streams:
  2037. @example
  2038. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2039. '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'
  2040. out
  2041. @end example
  2042. @section ladspa
  2043. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2044. To enable compilation of this filter you need to configure FFmpeg with
  2045. @code{--enable-ladspa}.
  2046. @table @option
  2047. @item file, f
  2048. Specifies the name of LADSPA plugin library to load. If the environment
  2049. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2050. each one of the directories specified by the colon separated list in
  2051. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2052. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2053. @file{/usr/lib/ladspa/}.
  2054. @item plugin, p
  2055. Specifies the plugin within the library. Some libraries contain only
  2056. one plugin, but others contain many of them. If this is not set filter
  2057. will list all available plugins within the specified library.
  2058. @item controls, c
  2059. Set the '|' separated list of controls which are zero or more floating point
  2060. values that determine the behavior of the loaded plugin (for example delay,
  2061. threshold or gain).
  2062. Controls need to be defined using the following syntax:
  2063. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2064. @var{valuei} is the value set on the @var{i}-th control.
  2065. Alternatively they can be also defined using the following syntax:
  2066. @var{value0}|@var{value1}|@var{value2}|..., where
  2067. @var{valuei} is the value set on the @var{i}-th control.
  2068. If @option{controls} is set to @code{help}, all available controls and
  2069. their valid ranges are printed.
  2070. @item sample_rate, s
  2071. Specify the sample rate, default to 44100. Only used if plugin have
  2072. zero inputs.
  2073. @item nb_samples, n
  2074. Set the number of samples per channel per each output frame, default
  2075. is 1024. Only used if plugin have zero inputs.
  2076. @item duration, d
  2077. Set the minimum duration of the sourced audio. See
  2078. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2079. for the accepted syntax.
  2080. Note that the resulting duration may be greater than the specified duration,
  2081. as the generated audio is always cut at the end of a complete frame.
  2082. If not specified, or the expressed duration is negative, the audio is
  2083. supposed to be generated forever.
  2084. Only used if plugin have zero inputs.
  2085. @end table
  2086. @subsection Examples
  2087. @itemize
  2088. @item
  2089. List all available plugins within amp (LADSPA example plugin) library:
  2090. @example
  2091. ladspa=file=amp
  2092. @end example
  2093. @item
  2094. List all available controls and their valid ranges for @code{vcf_notch}
  2095. plugin from @code{VCF} library:
  2096. @example
  2097. ladspa=f=vcf:p=vcf_notch:c=help
  2098. @end example
  2099. @item
  2100. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2101. plugin library:
  2102. @example
  2103. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2104. @end example
  2105. @item
  2106. Add reverberation to the audio using TAP-plugins
  2107. (Tom's Audio Processing plugins):
  2108. @example
  2109. ladspa=file=tap_reverb:tap_reverb
  2110. @end example
  2111. @item
  2112. Generate white noise, with 0.2 amplitude:
  2113. @example
  2114. ladspa=file=cmt:noise_source_white:c=c0=.2
  2115. @end example
  2116. @item
  2117. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2118. @code{C* Audio Plugin Suite} (CAPS) library:
  2119. @example
  2120. ladspa=file=caps:Click:c=c1=20'
  2121. @end example
  2122. @item
  2123. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2124. @example
  2125. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2126. @end example
  2127. @item
  2128. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2129. @code{SWH Plugins} collection:
  2130. @example
  2131. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2132. @end example
  2133. @item
  2134. Attenuate low frequencies using Multiband EQ from Steve Harris
  2135. @code{SWH Plugins} collection:
  2136. @example
  2137. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2138. @end example
  2139. @end itemize
  2140. @subsection Commands
  2141. This filter supports the following commands:
  2142. @table @option
  2143. @item cN
  2144. Modify the @var{N}-th control value.
  2145. If the specified value is not valid, it is ignored and prior one is kept.
  2146. @end table
  2147. @section loudnorm
  2148. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2149. Support for both single pass (livestreams, files) and double pass (files) modes.
  2150. This algorithm can target IL, LRA, and maximum true peak.
  2151. To enable compilation of this filter you need to configure FFmpeg with
  2152. @code{--enable-libebur128}.
  2153. The filter accepts the following options:
  2154. @table @option
  2155. @item I, i
  2156. Set integrated loudness target.
  2157. Range is -70.0 - -5.0. Default value is -24.0.
  2158. @item LRA, lra
  2159. Set loudness range target.
  2160. Range is 1.0 - 20.0. Default value is 7.0.
  2161. @item TP, tp
  2162. Set maximum true peak.
  2163. Range is -9.0 - +0.0. Default value is -2.0.
  2164. @item measured_I, measured_i
  2165. Measured IL of input file.
  2166. Range is -99.0 - +0.0.
  2167. @item measured_LRA, measured_lra
  2168. Measured LRA of input file.
  2169. Range is 0.0 - 99.0.
  2170. @item measured_TP, measured_tp
  2171. Measured true peak of input file.
  2172. Range is -99.0 - +99.0.
  2173. @item measured_thresh
  2174. Measured threshold of input file.
  2175. Range is -99.0 - +0.0.
  2176. @item offset
  2177. Set offset gain. Gain is applied before the true-peak limiter.
  2178. Range is -99.0 - +99.0. Default is +0.0.
  2179. @item linear
  2180. Normalize linearly if possible.
  2181. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2182. to be specified in order to use this mode.
  2183. Options are true or false. Default is true.
  2184. @item dual_mono
  2185. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2186. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2187. If set to @code{true}, this option will compensate for this effect.
  2188. Multi-channel input files are not affected by this option.
  2189. Options are true or false. Default is false.
  2190. @item print_format
  2191. Set print format for stats. Options are summary, json, or none.
  2192. Default value is none.
  2193. @end table
  2194. @section lowpass
  2195. Apply a low-pass filter with 3dB point frequency.
  2196. The filter can be either single-pole or double-pole (the default).
  2197. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2198. The filter accepts the following options:
  2199. @table @option
  2200. @item frequency, f
  2201. Set frequency in Hz. Default is 500.
  2202. @item poles, p
  2203. Set number of poles. Default is 2.
  2204. @item width_type
  2205. Set method to specify band-width of filter.
  2206. @table @option
  2207. @item h
  2208. Hz
  2209. @item q
  2210. Q-Factor
  2211. @item o
  2212. octave
  2213. @item s
  2214. slope
  2215. @end table
  2216. @item width, w
  2217. Specify the band-width of a filter in width_type units.
  2218. Applies only to double-pole filter.
  2219. The default is 0.707q and gives a Butterworth response.
  2220. @end table
  2221. @anchor{pan}
  2222. @section pan
  2223. Mix channels with specific gain levels. The filter accepts the output
  2224. channel layout followed by a set of channels definitions.
  2225. This filter is also designed to efficiently remap the channels of an audio
  2226. stream.
  2227. The filter accepts parameters of the form:
  2228. "@var{l}|@var{outdef}|@var{outdef}|..."
  2229. @table @option
  2230. @item l
  2231. output channel layout or number of channels
  2232. @item outdef
  2233. output channel specification, of the form:
  2234. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2235. @item out_name
  2236. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2237. number (c0, c1, etc.)
  2238. @item gain
  2239. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2240. @item in_name
  2241. input channel to use, see out_name for details; it is not possible to mix
  2242. named and numbered input channels
  2243. @end table
  2244. If the `=' in a channel specification is replaced by `<', then the gains for
  2245. that specification will be renormalized so that the total is 1, thus
  2246. avoiding clipping noise.
  2247. @subsection Mixing examples
  2248. For example, if you want to down-mix from stereo to mono, but with a bigger
  2249. factor for the left channel:
  2250. @example
  2251. pan=1c|c0=0.9*c0+0.1*c1
  2252. @end example
  2253. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2254. 7-channels surround:
  2255. @example
  2256. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2257. @end example
  2258. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2259. that should be preferred (see "-ac" option) unless you have very specific
  2260. needs.
  2261. @subsection Remapping examples
  2262. The channel remapping will be effective if, and only if:
  2263. @itemize
  2264. @item gain coefficients are zeroes or ones,
  2265. @item only one input per channel output,
  2266. @end itemize
  2267. If all these conditions are satisfied, the filter will notify the user ("Pure
  2268. channel mapping detected"), and use an optimized and lossless method to do the
  2269. remapping.
  2270. For example, if you have a 5.1 source and want a stereo audio stream by
  2271. dropping the extra channels:
  2272. @example
  2273. pan="stereo| c0=FL | c1=FR"
  2274. @end example
  2275. Given the same source, you can also switch front left and front right channels
  2276. and keep the input channel layout:
  2277. @example
  2278. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2279. @end example
  2280. If the input is a stereo audio stream, you can mute the front left channel (and
  2281. still keep the stereo channel layout) with:
  2282. @example
  2283. pan="stereo|c1=c1"
  2284. @end example
  2285. Still with a stereo audio stream input, you can copy the right channel in both
  2286. front left and right:
  2287. @example
  2288. pan="stereo| c0=FR | c1=FR"
  2289. @end example
  2290. @section replaygain
  2291. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2292. outputs it unchanged.
  2293. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2294. @section resample
  2295. Convert the audio sample format, sample rate and channel layout. It is
  2296. not meant to be used directly.
  2297. @section rubberband
  2298. Apply time-stretching and pitch-shifting with librubberband.
  2299. The filter accepts the following options:
  2300. @table @option
  2301. @item tempo
  2302. Set tempo scale factor.
  2303. @item pitch
  2304. Set pitch scale factor.
  2305. @item transients
  2306. Set transients detector.
  2307. Possible values are:
  2308. @table @var
  2309. @item crisp
  2310. @item mixed
  2311. @item smooth
  2312. @end table
  2313. @item detector
  2314. Set detector.
  2315. Possible values are:
  2316. @table @var
  2317. @item compound
  2318. @item percussive
  2319. @item soft
  2320. @end table
  2321. @item phase
  2322. Set phase.
  2323. Possible values are:
  2324. @table @var
  2325. @item laminar
  2326. @item independent
  2327. @end table
  2328. @item window
  2329. Set processing window size.
  2330. Possible values are:
  2331. @table @var
  2332. @item standard
  2333. @item short
  2334. @item long
  2335. @end table
  2336. @item smoothing
  2337. Set smoothing.
  2338. Possible values are:
  2339. @table @var
  2340. @item off
  2341. @item on
  2342. @end table
  2343. @item formant
  2344. Enable formant preservation when shift pitching.
  2345. Possible values are:
  2346. @table @var
  2347. @item shifted
  2348. @item preserved
  2349. @end table
  2350. @item pitchq
  2351. Set pitch quality.
  2352. Possible values are:
  2353. @table @var
  2354. @item quality
  2355. @item speed
  2356. @item consistency
  2357. @end table
  2358. @item channels
  2359. Set channels.
  2360. Possible values are:
  2361. @table @var
  2362. @item apart
  2363. @item together
  2364. @end table
  2365. @end table
  2366. @section sidechaincompress
  2367. This filter acts like normal compressor but has the ability to compress
  2368. detected signal using second input signal.
  2369. It needs two input streams and returns one output stream.
  2370. First input stream will be processed depending on second stream signal.
  2371. The filtered signal then can be filtered with other filters in later stages of
  2372. processing. See @ref{pan} and @ref{amerge} filter.
  2373. The filter accepts the following options:
  2374. @table @option
  2375. @item level_in
  2376. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2377. @item threshold
  2378. If a signal of second stream raises above this level it will affect the gain
  2379. reduction of first stream.
  2380. By default is 0.125. Range is between 0.00097563 and 1.
  2381. @item ratio
  2382. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2383. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2384. Default is 2. Range is between 1 and 20.
  2385. @item attack
  2386. Amount of milliseconds the signal has to rise above the threshold before gain
  2387. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2388. @item release
  2389. Amount of milliseconds the signal has to fall below the threshold before
  2390. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2391. @item makeup
  2392. Set the amount by how much signal will be amplified after processing.
  2393. Default is 2. Range is from 1 and 64.
  2394. @item knee
  2395. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2396. Default is 2.82843. Range is between 1 and 8.
  2397. @item link
  2398. Choose if the @code{average} level between all channels of side-chain stream
  2399. or the louder(@code{maximum}) channel of side-chain stream affects the
  2400. reduction. Default is @code{average}.
  2401. @item detection
  2402. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2403. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2404. @item level_sc
  2405. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2406. @item mix
  2407. How much to use compressed signal in output. Default is 1.
  2408. Range is between 0 and 1.
  2409. @end table
  2410. @subsection Examples
  2411. @itemize
  2412. @item
  2413. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2414. depending on the signal of 2nd input and later compressed signal to be
  2415. merged with 2nd input:
  2416. @example
  2417. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2418. @end example
  2419. @end itemize
  2420. @section sidechaingate
  2421. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2422. filter the detected signal before sending it to the gain reduction stage.
  2423. Normally a gate uses the full range signal to detect a level above the
  2424. threshold.
  2425. For example: If you cut all lower frequencies from your sidechain signal
  2426. the gate will decrease the volume of your track only if not enough highs
  2427. appear. With this technique you are able to reduce the resonation of a
  2428. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2429. guitar.
  2430. It needs two input streams and returns one output stream.
  2431. First input stream will be processed depending on second stream signal.
  2432. The filter accepts the following options:
  2433. @table @option
  2434. @item level_in
  2435. Set input level before filtering.
  2436. Default is 1. Allowed range is from 0.015625 to 64.
  2437. @item range
  2438. Set the level of gain reduction when the signal is below the threshold.
  2439. Default is 0.06125. Allowed range is from 0 to 1.
  2440. @item threshold
  2441. If a signal rises above this level the gain reduction is released.
  2442. Default is 0.125. Allowed range is from 0 to 1.
  2443. @item ratio
  2444. Set a ratio about which the signal is reduced.
  2445. Default is 2. Allowed range is from 1 to 9000.
  2446. @item attack
  2447. Amount of milliseconds the signal has to rise above the threshold before gain
  2448. reduction stops.
  2449. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2450. @item release
  2451. Amount of milliseconds the signal has to fall below the threshold before the
  2452. reduction is increased again. Default is 250 milliseconds.
  2453. Allowed range is from 0.01 to 9000.
  2454. @item makeup
  2455. Set amount of amplification of signal after processing.
  2456. Default is 1. Allowed range is from 1 to 64.
  2457. @item knee
  2458. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2459. Default is 2.828427125. Allowed range is from 1 to 8.
  2460. @item detection
  2461. Choose if exact signal should be taken for detection or an RMS like one.
  2462. Default is rms. Can be peak or rms.
  2463. @item link
  2464. Choose if the average level between all channels or the louder channel affects
  2465. the reduction.
  2466. Default is average. Can be average or maximum.
  2467. @item level_sc
  2468. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2469. @end table
  2470. @section silencedetect
  2471. Detect silence in an audio stream.
  2472. This filter logs a message when it detects that the input audio volume is less
  2473. or equal to a noise tolerance value for a duration greater or equal to the
  2474. minimum detected noise duration.
  2475. The printed times and duration are expressed in seconds.
  2476. The filter accepts the following options:
  2477. @table @option
  2478. @item duration, d
  2479. Set silence duration until notification (default is 2 seconds).
  2480. @item noise, n
  2481. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2482. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2483. @end table
  2484. @subsection Examples
  2485. @itemize
  2486. @item
  2487. Detect 5 seconds of silence with -50dB noise tolerance:
  2488. @example
  2489. silencedetect=n=-50dB:d=5
  2490. @end example
  2491. @item
  2492. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2493. tolerance in @file{silence.mp3}:
  2494. @example
  2495. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2496. @end example
  2497. @end itemize
  2498. @section silenceremove
  2499. Remove silence from the beginning, middle or end of the audio.
  2500. The filter accepts the following options:
  2501. @table @option
  2502. @item start_periods
  2503. This value is used to indicate if audio should be trimmed at beginning of
  2504. the audio. A value of zero indicates no silence should be trimmed from the
  2505. beginning. When specifying a non-zero value, it trims audio up until it
  2506. finds non-silence. Normally, when trimming silence from beginning of audio
  2507. the @var{start_periods} will be @code{1} but it can be increased to higher
  2508. values to trim all audio up to specific count of non-silence periods.
  2509. Default value is @code{0}.
  2510. @item start_duration
  2511. Specify the amount of time that non-silence must be detected before it stops
  2512. trimming audio. By increasing the duration, bursts of noises can be treated
  2513. as silence and trimmed off. Default value is @code{0}.
  2514. @item start_threshold
  2515. This indicates what sample value should be treated as silence. For digital
  2516. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2517. you may wish to increase the value to account for background noise.
  2518. Can be specified in dB (in case "dB" is appended to the specified value)
  2519. or amplitude ratio. Default value is @code{0}.
  2520. @item stop_periods
  2521. Set the count for trimming silence from the end of audio.
  2522. To remove silence from the middle of a file, specify a @var{stop_periods}
  2523. that is negative. This value is then treated as a positive value and is
  2524. used to indicate the effect should restart processing as specified by
  2525. @var{start_periods}, making it suitable for removing periods of silence
  2526. in the middle of the audio.
  2527. Default value is @code{0}.
  2528. @item stop_duration
  2529. Specify a duration of silence that must exist before audio is not copied any
  2530. more. By specifying a higher duration, silence that is wanted can be left in
  2531. the audio.
  2532. Default value is @code{0}.
  2533. @item stop_threshold
  2534. This is the same as @option{start_threshold} but for trimming silence from
  2535. the end of audio.
  2536. Can be specified in dB (in case "dB" is appended to the specified value)
  2537. or amplitude ratio. Default value is @code{0}.
  2538. @item leave_silence
  2539. This indicates that @var{stop_duration} length of audio should be left intact
  2540. at the beginning of each period of silence.
  2541. For example, if you want to remove long pauses between words but do not want
  2542. to remove the pauses completely. Default value is @code{0}.
  2543. @item detection
  2544. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2545. and works better with digital silence which is exactly 0.
  2546. Default value is @code{rms}.
  2547. @item window
  2548. Set ratio used to calculate size of window for detecting silence.
  2549. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2550. @end table
  2551. @subsection Examples
  2552. @itemize
  2553. @item
  2554. The following example shows how this filter can be used to start a recording
  2555. that does not contain the delay at the start which usually occurs between
  2556. pressing the record button and the start of the performance:
  2557. @example
  2558. silenceremove=1:5:0.02
  2559. @end example
  2560. @item
  2561. Trim all silence encountered from begining to end where there is more than 1
  2562. second of silence in audio:
  2563. @example
  2564. silenceremove=0:0:0:-1:1:-90dB
  2565. @end example
  2566. @end itemize
  2567. @section sofalizer
  2568. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2569. loudspeakers around the user for binaural listening via headphones (audio
  2570. formats up to 9 channels supported).
  2571. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2572. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2573. Austrian Academy of Sciences.
  2574. To enable compilation of this filter you need to configure FFmpeg with
  2575. @code{--enable-netcdf}.
  2576. The filter accepts the following options:
  2577. @table @option
  2578. @item sofa
  2579. Set the SOFA file used for rendering.
  2580. @item gain
  2581. Set gain applied to audio. Value is in dB. Default is 0.
  2582. @item rotation
  2583. Set rotation of virtual loudspeakers in deg. Default is 0.
  2584. @item elevation
  2585. Set elevation of virtual speakers in deg. Default is 0.
  2586. @item radius
  2587. Set distance in meters between loudspeakers and the listener with near-field
  2588. HRTFs. Default is 1.
  2589. @item type
  2590. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2591. processing audio in time domain which is slow.
  2592. @var{freq} is processing audio in frequency domain which is fast.
  2593. Default is @var{freq}.
  2594. @item speakers
  2595. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2596. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2597. Each virtual loudspeaker is described with short channel name following with
  2598. azimuth and elevation in degreees.
  2599. Each virtual loudspeaker description is separated by '|'.
  2600. For example to override front left and front right channel positions use:
  2601. 'speakers=FL 45 15|FR 345 15'.
  2602. Descriptions with unrecognised channel names are ignored.
  2603. @end table
  2604. @subsection Examples
  2605. @itemize
  2606. @item
  2607. Using ClubFritz6 sofa file:
  2608. @example
  2609. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2610. @end example
  2611. @item
  2612. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2613. @example
  2614. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2615. @end example
  2616. @item
  2617. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2618. and also with custom gain:
  2619. @example
  2620. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2621. @end example
  2622. @end itemize
  2623. @section stereotools
  2624. This filter has some handy utilities to manage stereo signals, for converting
  2625. M/S stereo recordings to L/R signal while having control over the parameters
  2626. or spreading the stereo image of master track.
  2627. The filter accepts the following options:
  2628. @table @option
  2629. @item level_in
  2630. Set input level before filtering for both channels. Defaults is 1.
  2631. Allowed range is from 0.015625 to 64.
  2632. @item level_out
  2633. Set output level after filtering for both channels. Defaults is 1.
  2634. Allowed range is from 0.015625 to 64.
  2635. @item balance_in
  2636. Set input balance between both channels. Default is 0.
  2637. Allowed range is from -1 to 1.
  2638. @item balance_out
  2639. Set output balance between both channels. Default is 0.
  2640. Allowed range is from -1 to 1.
  2641. @item softclip
  2642. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2643. clipping. Disabled by default.
  2644. @item mutel
  2645. Mute the left channel. Disabled by default.
  2646. @item muter
  2647. Mute the right channel. Disabled by default.
  2648. @item phasel
  2649. Change the phase of the left channel. Disabled by default.
  2650. @item phaser
  2651. Change the phase of the right channel. Disabled by default.
  2652. @item mode
  2653. Set stereo mode. Available values are:
  2654. @table @samp
  2655. @item lr>lr
  2656. Left/Right to Left/Right, this is default.
  2657. @item lr>ms
  2658. Left/Right to Mid/Side.
  2659. @item ms>lr
  2660. Mid/Side to Left/Right.
  2661. @item lr>ll
  2662. Left/Right to Left/Left.
  2663. @item lr>rr
  2664. Left/Right to Right/Right.
  2665. @item lr>l+r
  2666. Left/Right to Left + Right.
  2667. @item lr>rl
  2668. Left/Right to Right/Left.
  2669. @end table
  2670. @item slev
  2671. Set level of side signal. Default is 1.
  2672. Allowed range is from 0.015625 to 64.
  2673. @item sbal
  2674. Set balance of side signal. Default is 0.
  2675. Allowed range is from -1 to 1.
  2676. @item mlev
  2677. Set level of the middle signal. Default is 1.
  2678. Allowed range is from 0.015625 to 64.
  2679. @item mpan
  2680. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2681. @item base
  2682. Set stereo base between mono and inversed channels. Default is 0.
  2683. Allowed range is from -1 to 1.
  2684. @item delay
  2685. Set delay in milliseconds how much to delay left from right channel and
  2686. vice versa. Default is 0. Allowed range is from -20 to 20.
  2687. @item sclevel
  2688. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2689. @item phase
  2690. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2691. @end table
  2692. @subsection Examples
  2693. @itemize
  2694. @item
  2695. Apply karaoke like effect:
  2696. @example
  2697. stereotools=mlev=0.015625
  2698. @end example
  2699. @item
  2700. Convert M/S signal to L/R:
  2701. @example
  2702. "stereotools=mode=ms>lr"
  2703. @end example
  2704. @end itemize
  2705. @section stereowiden
  2706. This filter enhance the stereo effect by suppressing signal common to both
  2707. channels and by delaying the signal of left into right and vice versa,
  2708. thereby widening the stereo effect.
  2709. The filter accepts the following options:
  2710. @table @option
  2711. @item delay
  2712. Time in milliseconds of the delay of left signal into right and vice versa.
  2713. Default is 20 milliseconds.
  2714. @item feedback
  2715. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2716. effect of left signal in right output and vice versa which gives widening
  2717. effect. Default is 0.3.
  2718. @item crossfeed
  2719. Cross feed of left into right with inverted phase. This helps in suppressing
  2720. the mono. If the value is 1 it will cancel all the signal common to both
  2721. channels. Default is 0.3.
  2722. @item drymix
  2723. Set level of input signal of original channel. Default is 0.8.
  2724. @end table
  2725. @section scale_npp
  2726. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  2727. format conversion on CUDA video frames. Setting the output width and height
  2728. works in the same way as for the @var{scale} filter.
  2729. The following additional options are accepted:
  2730. @table @option
  2731. @item format
  2732. The pixel format of the output CUDA frames. If set to the string "same" (the
  2733. default), the input format will be kept. Note that automatic format negotiation
  2734. and conversion is not yet supported for hardware frames
  2735. @item interp_algo
  2736. The interpolation algorithm used for resizing. One of the following:
  2737. @table @option
  2738. @item nn
  2739. Nearest neighbour.
  2740. @item linear
  2741. @item cubic
  2742. @item cubic2p_bspline
  2743. 2-parameter cubic (B=1, C=0)
  2744. @item cubic2p_catmullrom
  2745. 2-parameter cubic (B=0, C=1/2)
  2746. @item cubic2p_b05c03
  2747. 2-parameter cubic (B=1/2, C=3/10)
  2748. @item super
  2749. Supersampling
  2750. @item lanczos
  2751. @end table
  2752. @end table
  2753. @section select
  2754. Select frames to pass in output.
  2755. @section treble
  2756. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2757. shelving filter with a response similar to that of a standard
  2758. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2759. The filter accepts the following options:
  2760. @table @option
  2761. @item gain, g
  2762. Give the gain at whichever is the lower of ~22 kHz and the
  2763. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2764. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2765. @item frequency, f
  2766. Set the filter's central frequency and so can be used
  2767. to extend or reduce the frequency range to be boosted or cut.
  2768. The default value is @code{3000} Hz.
  2769. @item width_type
  2770. Set method to specify band-width of filter.
  2771. @table @option
  2772. @item h
  2773. Hz
  2774. @item q
  2775. Q-Factor
  2776. @item o
  2777. octave
  2778. @item s
  2779. slope
  2780. @end table
  2781. @item width, w
  2782. Determine how steep is the filter's shelf transition.
  2783. @end table
  2784. @section tremolo
  2785. Sinusoidal amplitude modulation.
  2786. The filter accepts the following options:
  2787. @table @option
  2788. @item f
  2789. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2790. (20 Hz or lower) will result in a tremolo effect.
  2791. This filter may also be used as a ring modulator by specifying
  2792. a modulation frequency higher than 20 Hz.
  2793. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2794. @item d
  2795. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2796. Default value is 0.5.
  2797. @end table
  2798. @section vibrato
  2799. Sinusoidal phase modulation.
  2800. The filter accepts the following options:
  2801. @table @option
  2802. @item f
  2803. Modulation frequency in Hertz.
  2804. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2805. @item d
  2806. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2807. Default value is 0.5.
  2808. @end table
  2809. @section volume
  2810. Adjust the input audio volume.
  2811. It accepts the following parameters:
  2812. @table @option
  2813. @item volume
  2814. Set audio volume expression.
  2815. Output values are clipped to the maximum value.
  2816. The output audio volume is given by the relation:
  2817. @example
  2818. @var{output_volume} = @var{volume} * @var{input_volume}
  2819. @end example
  2820. The default value for @var{volume} is "1.0".
  2821. @item precision
  2822. This parameter represents the mathematical precision.
  2823. It determines which input sample formats will be allowed, which affects the
  2824. precision of the volume scaling.
  2825. @table @option
  2826. @item fixed
  2827. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2828. @item float
  2829. 32-bit floating-point; this limits input sample format to FLT. (default)
  2830. @item double
  2831. 64-bit floating-point; this limits input sample format to DBL.
  2832. @end table
  2833. @item replaygain
  2834. Choose the behaviour on encountering ReplayGain side data in input frames.
  2835. @table @option
  2836. @item drop
  2837. Remove ReplayGain side data, ignoring its contents (the default).
  2838. @item ignore
  2839. Ignore ReplayGain side data, but leave it in the frame.
  2840. @item track
  2841. Prefer the track gain, if present.
  2842. @item album
  2843. Prefer the album gain, if present.
  2844. @end table
  2845. @item replaygain_preamp
  2846. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2847. Default value for @var{replaygain_preamp} is 0.0.
  2848. @item eval
  2849. Set when the volume expression is evaluated.
  2850. It accepts the following values:
  2851. @table @samp
  2852. @item once
  2853. only evaluate expression once during the filter initialization, or
  2854. when the @samp{volume} command is sent
  2855. @item frame
  2856. evaluate expression for each incoming frame
  2857. @end table
  2858. Default value is @samp{once}.
  2859. @end table
  2860. The volume expression can contain the following parameters.
  2861. @table @option
  2862. @item n
  2863. frame number (starting at zero)
  2864. @item nb_channels
  2865. number of channels
  2866. @item nb_consumed_samples
  2867. number of samples consumed by the filter
  2868. @item nb_samples
  2869. number of samples in the current frame
  2870. @item pos
  2871. original frame position in the file
  2872. @item pts
  2873. frame PTS
  2874. @item sample_rate
  2875. sample rate
  2876. @item startpts
  2877. PTS at start of stream
  2878. @item startt
  2879. time at start of stream
  2880. @item t
  2881. frame time
  2882. @item tb
  2883. timestamp timebase
  2884. @item volume
  2885. last set volume value
  2886. @end table
  2887. Note that when @option{eval} is set to @samp{once} only the
  2888. @var{sample_rate} and @var{tb} variables are available, all other
  2889. variables will evaluate to NAN.
  2890. @subsection Commands
  2891. This filter supports the following commands:
  2892. @table @option
  2893. @item volume
  2894. Modify the volume expression.
  2895. The command accepts the same syntax of the corresponding option.
  2896. If the specified expression is not valid, it is kept at its current
  2897. value.
  2898. @item replaygain_noclip
  2899. Prevent clipping by limiting the gain applied.
  2900. Default value for @var{replaygain_noclip} is 1.
  2901. @end table
  2902. @subsection Examples
  2903. @itemize
  2904. @item
  2905. Halve the input audio volume:
  2906. @example
  2907. volume=volume=0.5
  2908. volume=volume=1/2
  2909. volume=volume=-6.0206dB
  2910. @end example
  2911. In all the above example the named key for @option{volume} can be
  2912. omitted, for example like in:
  2913. @example
  2914. volume=0.5
  2915. @end example
  2916. @item
  2917. Increase input audio power by 6 decibels using fixed-point precision:
  2918. @example
  2919. volume=volume=6dB:precision=fixed
  2920. @end example
  2921. @item
  2922. Fade volume after time 10 with an annihilation period of 5 seconds:
  2923. @example
  2924. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2925. @end example
  2926. @end itemize
  2927. @section volumedetect
  2928. Detect the volume of the input video.
  2929. The filter has no parameters. The input is not modified. Statistics about
  2930. the volume will be printed in the log when the input stream end is reached.
  2931. In particular it will show the mean volume (root mean square), maximum
  2932. volume (on a per-sample basis), and the beginning of a histogram of the
  2933. registered volume values (from the maximum value to a cumulated 1/1000 of
  2934. the samples).
  2935. All volumes are in decibels relative to the maximum PCM value.
  2936. @subsection Examples
  2937. Here is an excerpt of the output:
  2938. @example
  2939. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2940. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2941. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2942. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2943. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2944. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2945. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2946. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2947. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2948. @end example
  2949. It means that:
  2950. @itemize
  2951. @item
  2952. The mean square energy is approximately -27 dB, or 10^-2.7.
  2953. @item
  2954. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2955. @item
  2956. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2957. @end itemize
  2958. In other words, raising the volume by +4 dB does not cause any clipping,
  2959. raising it by +5 dB causes clipping for 6 samples, etc.
  2960. @c man end AUDIO FILTERS
  2961. @chapter Audio Sources
  2962. @c man begin AUDIO SOURCES
  2963. Below is a description of the currently available audio sources.
  2964. @section abuffer
  2965. Buffer audio frames, and make them available to the filter chain.
  2966. This source is mainly intended for a programmatic use, in particular
  2967. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2968. It accepts the following parameters:
  2969. @table @option
  2970. @item time_base
  2971. The timebase which will be used for timestamps of submitted frames. It must be
  2972. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2973. @item sample_rate
  2974. The sample rate of the incoming audio buffers.
  2975. @item sample_fmt
  2976. The sample format of the incoming audio buffers.
  2977. Either a sample format name or its corresponding integer representation from
  2978. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2979. @item channel_layout
  2980. The channel layout of the incoming audio buffers.
  2981. Either a channel layout name from channel_layout_map in
  2982. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2983. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2984. @item channels
  2985. The number of channels of the incoming audio buffers.
  2986. If both @var{channels} and @var{channel_layout} are specified, then they
  2987. must be consistent.
  2988. @end table
  2989. @subsection Examples
  2990. @example
  2991. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2992. @end example
  2993. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2994. Since the sample format with name "s16p" corresponds to the number
  2995. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2996. equivalent to:
  2997. @example
  2998. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2999. @end example
  3000. @section aevalsrc
  3001. Generate an audio signal specified by an expression.
  3002. This source accepts in input one or more expressions (one for each
  3003. channel), which are evaluated and used to generate a corresponding
  3004. audio signal.
  3005. This source accepts the following options:
  3006. @table @option
  3007. @item exprs
  3008. Set the '|'-separated expressions list for each separate channel. In case the
  3009. @option{channel_layout} option is not specified, the selected channel layout
  3010. depends on the number of provided expressions. Otherwise the last
  3011. specified expression is applied to the remaining output channels.
  3012. @item channel_layout, c
  3013. Set the channel layout. The number of channels in the specified layout
  3014. must be equal to the number of specified expressions.
  3015. @item duration, d
  3016. Set the minimum duration of the sourced audio. See
  3017. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3018. for the accepted syntax.
  3019. Note that the resulting duration may be greater than the specified
  3020. duration, as the generated audio is always cut at the end of a
  3021. complete frame.
  3022. If not specified, or the expressed duration is negative, the audio is
  3023. supposed to be generated forever.
  3024. @item nb_samples, n
  3025. Set the number of samples per channel per each output frame,
  3026. default to 1024.
  3027. @item sample_rate, s
  3028. Specify the sample rate, default to 44100.
  3029. @end table
  3030. Each expression in @var{exprs} can contain the following constants:
  3031. @table @option
  3032. @item n
  3033. number of the evaluated sample, starting from 0
  3034. @item t
  3035. time of the evaluated sample expressed in seconds, starting from 0
  3036. @item s
  3037. sample rate
  3038. @end table
  3039. @subsection Examples
  3040. @itemize
  3041. @item
  3042. Generate silence:
  3043. @example
  3044. aevalsrc=0
  3045. @end example
  3046. @item
  3047. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3048. 8000 Hz:
  3049. @example
  3050. aevalsrc="sin(440*2*PI*t):s=8000"
  3051. @end example
  3052. @item
  3053. Generate a two channels signal, specify the channel layout (Front
  3054. Center + Back Center) explicitly:
  3055. @example
  3056. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3057. @end example
  3058. @item
  3059. Generate white noise:
  3060. @example
  3061. aevalsrc="-2+random(0)"
  3062. @end example
  3063. @item
  3064. Generate an amplitude modulated signal:
  3065. @example
  3066. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3067. @end example
  3068. @item
  3069. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3070. @example
  3071. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3072. @end example
  3073. @end itemize
  3074. @section anullsrc
  3075. The null audio source, return unprocessed audio frames. It is mainly useful
  3076. as a template and to be employed in analysis / debugging tools, or as
  3077. the source for filters which ignore the input data (for example the sox
  3078. synth filter).
  3079. This source accepts the following options:
  3080. @table @option
  3081. @item channel_layout, cl
  3082. Specifies the channel layout, and can be either an integer or a string
  3083. representing a channel layout. The default value of @var{channel_layout}
  3084. is "stereo".
  3085. Check the channel_layout_map definition in
  3086. @file{libavutil/channel_layout.c} for the mapping between strings and
  3087. channel layout values.
  3088. @item sample_rate, r
  3089. Specifies the sample rate, and defaults to 44100.
  3090. @item nb_samples, n
  3091. Set the number of samples per requested frames.
  3092. @end table
  3093. @subsection Examples
  3094. @itemize
  3095. @item
  3096. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3097. @example
  3098. anullsrc=r=48000:cl=4
  3099. @end example
  3100. @item
  3101. Do the same operation with a more obvious syntax:
  3102. @example
  3103. anullsrc=r=48000:cl=mono
  3104. @end example
  3105. @end itemize
  3106. All the parameters need to be explicitly defined.
  3107. @section flite
  3108. Synthesize a voice utterance using the libflite library.
  3109. To enable compilation of this filter you need to configure FFmpeg with
  3110. @code{--enable-libflite}.
  3111. Note that the flite library is not thread-safe.
  3112. The filter accepts the following options:
  3113. @table @option
  3114. @item list_voices
  3115. If set to 1, list the names of the available voices and exit
  3116. immediately. Default value is 0.
  3117. @item nb_samples, n
  3118. Set the maximum number of samples per frame. Default value is 512.
  3119. @item textfile
  3120. Set the filename containing the text to speak.
  3121. @item text
  3122. Set the text to speak.
  3123. @item voice, v
  3124. Set the voice to use for the speech synthesis. Default value is
  3125. @code{kal}. See also the @var{list_voices} option.
  3126. @end table
  3127. @subsection Examples
  3128. @itemize
  3129. @item
  3130. Read from file @file{speech.txt}, and synthesize the text using the
  3131. standard flite voice:
  3132. @example
  3133. flite=textfile=speech.txt
  3134. @end example
  3135. @item
  3136. Read the specified text selecting the @code{slt} voice:
  3137. @example
  3138. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3139. @end example
  3140. @item
  3141. Input text to ffmpeg:
  3142. @example
  3143. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3144. @end example
  3145. @item
  3146. Make @file{ffplay} speak the specified text, using @code{flite} and
  3147. the @code{lavfi} device:
  3148. @example
  3149. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3150. @end example
  3151. @end itemize
  3152. For more information about libflite, check:
  3153. @url{http://www.speech.cs.cmu.edu/flite/}
  3154. @section anoisesrc
  3155. Generate a noise audio signal.
  3156. The filter accepts the following options:
  3157. @table @option
  3158. @item sample_rate, r
  3159. Specify the sample rate. Default value is 48000 Hz.
  3160. @item amplitude, a
  3161. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3162. is 1.0.
  3163. @item duration, d
  3164. Specify the duration of the generated audio stream. Not specifying this option
  3165. results in noise with an infinite length.
  3166. @item color, colour, c
  3167. Specify the color of noise. Available noise colors are white, pink, and brown.
  3168. Default color is white.
  3169. @item seed, s
  3170. Specify a value used to seed the PRNG.
  3171. @item nb_samples, n
  3172. Set the number of samples per each output frame, default is 1024.
  3173. @end table
  3174. @subsection Examples
  3175. @itemize
  3176. @item
  3177. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3178. @example
  3179. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3180. @end example
  3181. @end itemize
  3182. @section sine
  3183. Generate an audio signal made of a sine wave with amplitude 1/8.
  3184. The audio signal is bit-exact.
  3185. The filter accepts the following options:
  3186. @table @option
  3187. @item frequency, f
  3188. Set the carrier frequency. Default is 440 Hz.
  3189. @item beep_factor, b
  3190. Enable a periodic beep every second with frequency @var{beep_factor} times
  3191. the carrier frequency. Default is 0, meaning the beep is disabled.
  3192. @item sample_rate, r
  3193. Specify the sample rate, default is 44100.
  3194. @item duration, d
  3195. Specify the duration of the generated audio stream.
  3196. @item samples_per_frame
  3197. Set the number of samples per output frame.
  3198. The expression can contain the following constants:
  3199. @table @option
  3200. @item n
  3201. The (sequential) number of the output audio frame, starting from 0.
  3202. @item pts
  3203. The PTS (Presentation TimeStamp) of the output audio frame,
  3204. expressed in @var{TB} units.
  3205. @item t
  3206. The PTS of the output audio frame, expressed in seconds.
  3207. @item TB
  3208. The timebase of the output audio frames.
  3209. @end table
  3210. Default is @code{1024}.
  3211. @end table
  3212. @subsection Examples
  3213. @itemize
  3214. @item
  3215. Generate a simple 440 Hz sine wave:
  3216. @example
  3217. sine
  3218. @end example
  3219. @item
  3220. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3221. @example
  3222. sine=220:4:d=5
  3223. sine=f=220:b=4:d=5
  3224. sine=frequency=220:beep_factor=4:duration=5
  3225. @end example
  3226. @item
  3227. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3228. pattern:
  3229. @example
  3230. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3231. @end example
  3232. @end itemize
  3233. @c man end AUDIO SOURCES
  3234. @chapter Audio Sinks
  3235. @c man begin AUDIO SINKS
  3236. Below is a description of the currently available audio sinks.
  3237. @section abuffersink
  3238. Buffer audio frames, and make them available to the end of filter chain.
  3239. This sink is mainly intended for programmatic use, in particular
  3240. through the interface defined in @file{libavfilter/buffersink.h}
  3241. or the options system.
  3242. It accepts a pointer to an AVABufferSinkContext structure, which
  3243. defines the incoming buffers' formats, to be passed as the opaque
  3244. parameter to @code{avfilter_init_filter} for initialization.
  3245. @section anullsink
  3246. Null audio sink; do absolutely nothing with the input audio. It is
  3247. mainly useful as a template and for use in analysis / debugging
  3248. tools.
  3249. @c man end AUDIO SINKS
  3250. @chapter Video Filters
  3251. @c man begin VIDEO FILTERS
  3252. When you configure your FFmpeg build, you can disable any of the
  3253. existing filters using @code{--disable-filters}.
  3254. The configure output will show the video filters included in your
  3255. build.
  3256. Below is a description of the currently available video filters.
  3257. @section alphaextract
  3258. Extract the alpha component from the input as a grayscale video. This
  3259. is especially useful with the @var{alphamerge} filter.
  3260. @section alphamerge
  3261. Add or replace the alpha component of the primary input with the
  3262. grayscale value of a second input. This is intended for use with
  3263. @var{alphaextract} to allow the transmission or storage of frame
  3264. sequences that have alpha in a format that doesn't support an alpha
  3265. channel.
  3266. For example, to reconstruct full frames from a normal YUV-encoded video
  3267. and a separate video created with @var{alphaextract}, you might use:
  3268. @example
  3269. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3270. @end example
  3271. Since this filter is designed for reconstruction, it operates on frame
  3272. sequences without considering timestamps, and terminates when either
  3273. input reaches end of stream. This will cause problems if your encoding
  3274. pipeline drops frames. If you're trying to apply an image as an
  3275. overlay to a video stream, consider the @var{overlay} filter instead.
  3276. @section ass
  3277. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3278. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3279. Substation Alpha) subtitles files.
  3280. This filter accepts the following option in addition to the common options from
  3281. the @ref{subtitles} filter:
  3282. @table @option
  3283. @item shaping
  3284. Set the shaping engine
  3285. Available values are:
  3286. @table @samp
  3287. @item auto
  3288. The default libass shaping engine, which is the best available.
  3289. @item simple
  3290. Fast, font-agnostic shaper that can do only substitutions
  3291. @item complex
  3292. Slower shaper using OpenType for substitutions and positioning
  3293. @end table
  3294. The default is @code{auto}.
  3295. @end table
  3296. @section atadenoise
  3297. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3298. The filter accepts the following options:
  3299. @table @option
  3300. @item 0a
  3301. Set threshold A for 1st plane. Default is 0.02.
  3302. Valid range is 0 to 0.3.
  3303. @item 0b
  3304. Set threshold B for 1st plane. Default is 0.04.
  3305. Valid range is 0 to 5.
  3306. @item 1a
  3307. Set threshold A for 2nd plane. Default is 0.02.
  3308. Valid range is 0 to 0.3.
  3309. @item 1b
  3310. Set threshold B for 2nd plane. Default is 0.04.
  3311. Valid range is 0 to 5.
  3312. @item 2a
  3313. Set threshold A for 3rd plane. Default is 0.02.
  3314. Valid range is 0 to 0.3.
  3315. @item 2b
  3316. Set threshold B for 3rd plane. Default is 0.04.
  3317. Valid range is 0 to 5.
  3318. Threshold A is designed to react on abrupt changes in the input signal and
  3319. threshold B is designed to react on continuous changes in the input signal.
  3320. @item s
  3321. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3322. number in range [5, 129].
  3323. @end table
  3324. @section bbox
  3325. Compute the bounding box for the non-black pixels in the input frame
  3326. luminance plane.
  3327. This filter computes the bounding box containing all the pixels with a
  3328. luminance value greater than the minimum allowed value.
  3329. The parameters describing the bounding box are printed on the filter
  3330. log.
  3331. The filter accepts the following option:
  3332. @table @option
  3333. @item min_val
  3334. Set the minimal luminance value. Default is @code{16}.
  3335. @end table
  3336. @section blackdetect
  3337. Detect video intervals that are (almost) completely black. Can be
  3338. useful to detect chapter transitions, commercials, or invalid
  3339. recordings. Output lines contains the time for the start, end and
  3340. duration of the detected black interval expressed in seconds.
  3341. In order to display the output lines, you need to set the loglevel at
  3342. least to the AV_LOG_INFO value.
  3343. The filter accepts the following options:
  3344. @table @option
  3345. @item black_min_duration, d
  3346. Set the minimum detected black duration expressed in seconds. It must
  3347. be a non-negative floating point number.
  3348. Default value is 2.0.
  3349. @item picture_black_ratio_th, pic_th
  3350. Set the threshold for considering a picture "black".
  3351. Express the minimum value for the ratio:
  3352. @example
  3353. @var{nb_black_pixels} / @var{nb_pixels}
  3354. @end example
  3355. for which a picture is considered black.
  3356. Default value is 0.98.
  3357. @item pixel_black_th, pix_th
  3358. Set the threshold for considering a pixel "black".
  3359. The threshold expresses the maximum pixel luminance value for which a
  3360. pixel is considered "black". The provided value is scaled according to
  3361. the following equation:
  3362. @example
  3363. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3364. @end example
  3365. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3366. the input video format, the range is [0-255] for YUV full-range
  3367. formats and [16-235] for YUV non full-range formats.
  3368. Default value is 0.10.
  3369. @end table
  3370. The following example sets the maximum pixel threshold to the minimum
  3371. value, and detects only black intervals of 2 or more seconds:
  3372. @example
  3373. blackdetect=d=2:pix_th=0.00
  3374. @end example
  3375. @section blackframe
  3376. Detect frames that are (almost) completely black. Can be useful to
  3377. detect chapter transitions or commercials. Output lines consist of
  3378. the frame number of the detected frame, the percentage of blackness,
  3379. the position in the file if known or -1 and the timestamp in seconds.
  3380. In order to display the output lines, you need to set the loglevel at
  3381. least to the AV_LOG_INFO value.
  3382. It accepts the following parameters:
  3383. @table @option
  3384. @item amount
  3385. The percentage of the pixels that have to be below the threshold; it defaults to
  3386. @code{98}.
  3387. @item threshold, thresh
  3388. The threshold below which a pixel value is considered black; it defaults to
  3389. @code{32}.
  3390. @end table
  3391. @section blend, tblend
  3392. Blend two video frames into each other.
  3393. The @code{blend} filter takes two input streams and outputs one
  3394. stream, the first input is the "top" layer and second input is
  3395. "bottom" layer. Output terminates when shortest input terminates.
  3396. The @code{tblend} (time blend) filter takes two consecutive frames
  3397. from one single stream, and outputs the result obtained by blending
  3398. the new frame on top of the old frame.
  3399. A description of the accepted options follows.
  3400. @table @option
  3401. @item c0_mode
  3402. @item c1_mode
  3403. @item c2_mode
  3404. @item c3_mode
  3405. @item all_mode
  3406. Set blend mode for specific pixel component or all pixel components in case
  3407. of @var{all_mode}. Default value is @code{normal}.
  3408. Available values for component modes are:
  3409. @table @samp
  3410. @item addition
  3411. @item addition128
  3412. @item and
  3413. @item average
  3414. @item burn
  3415. @item darken
  3416. @item difference
  3417. @item difference128
  3418. @item divide
  3419. @item dodge
  3420. @item freeze
  3421. @item exclusion
  3422. @item glow
  3423. @item hardlight
  3424. @item hardmix
  3425. @item heat
  3426. @item lighten
  3427. @item linearlight
  3428. @item multiply
  3429. @item multiply128
  3430. @item negation
  3431. @item normal
  3432. @item or
  3433. @item overlay
  3434. @item phoenix
  3435. @item pinlight
  3436. @item reflect
  3437. @item screen
  3438. @item softlight
  3439. @item subtract
  3440. @item vividlight
  3441. @item xor
  3442. @end table
  3443. @item c0_opacity
  3444. @item c1_opacity
  3445. @item c2_opacity
  3446. @item c3_opacity
  3447. @item all_opacity
  3448. Set blend opacity for specific pixel component or all pixel components in case
  3449. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3450. @item c0_expr
  3451. @item c1_expr
  3452. @item c2_expr
  3453. @item c3_expr
  3454. @item all_expr
  3455. Set blend expression for specific pixel component or all pixel components in case
  3456. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3457. The expressions can use the following variables:
  3458. @table @option
  3459. @item N
  3460. The sequential number of the filtered frame, starting from @code{0}.
  3461. @item X
  3462. @item Y
  3463. the coordinates of the current sample
  3464. @item W
  3465. @item H
  3466. the width and height of currently filtered plane
  3467. @item SW
  3468. @item SH
  3469. Width and height scale depending on the currently filtered plane. It is the
  3470. ratio between the corresponding luma plane number of pixels and the current
  3471. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3472. @code{0.5,0.5} for chroma planes.
  3473. @item T
  3474. Time of the current frame, expressed in seconds.
  3475. @item TOP, A
  3476. Value of pixel component at current location for first video frame (top layer).
  3477. @item BOTTOM, B
  3478. Value of pixel component at current location for second video frame (bottom layer).
  3479. @end table
  3480. @item shortest
  3481. Force termination when the shortest input terminates. Default is
  3482. @code{0}. This option is only defined for the @code{blend} filter.
  3483. @item repeatlast
  3484. Continue applying the last bottom frame after the end of the stream. A value of
  3485. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3486. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3487. @end table
  3488. @subsection Examples
  3489. @itemize
  3490. @item
  3491. Apply transition from bottom layer to top layer in first 10 seconds:
  3492. @example
  3493. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3494. @end example
  3495. @item
  3496. Apply 1x1 checkerboard effect:
  3497. @example
  3498. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3499. @end example
  3500. @item
  3501. Apply uncover left effect:
  3502. @example
  3503. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3504. @end example
  3505. @item
  3506. Apply uncover down effect:
  3507. @example
  3508. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3509. @end example
  3510. @item
  3511. Apply uncover up-left effect:
  3512. @example
  3513. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3514. @end example
  3515. @item
  3516. Split diagonally video and shows top and bottom layer on each side:
  3517. @example
  3518. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3519. @end example
  3520. @item
  3521. Display differences between the current and the previous frame:
  3522. @example
  3523. tblend=all_mode=difference128
  3524. @end example
  3525. @end itemize
  3526. @section boxblur
  3527. Apply a boxblur algorithm to the input video.
  3528. It accepts the following parameters:
  3529. @table @option
  3530. @item luma_radius, lr
  3531. @item luma_power, lp
  3532. @item chroma_radius, cr
  3533. @item chroma_power, cp
  3534. @item alpha_radius, ar
  3535. @item alpha_power, ap
  3536. @end table
  3537. A description of the accepted options follows.
  3538. @table @option
  3539. @item luma_radius, lr
  3540. @item chroma_radius, cr
  3541. @item alpha_radius, ar
  3542. Set an expression for the box radius in pixels used for blurring the
  3543. corresponding input plane.
  3544. The radius value must be a non-negative number, and must not be
  3545. greater than the value of the expression @code{min(w,h)/2} for the
  3546. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3547. planes.
  3548. Default value for @option{luma_radius} is "2". If not specified,
  3549. @option{chroma_radius} and @option{alpha_radius} default to the
  3550. corresponding value set for @option{luma_radius}.
  3551. The expressions can contain the following constants:
  3552. @table @option
  3553. @item w
  3554. @item h
  3555. The input width and height in pixels.
  3556. @item cw
  3557. @item ch
  3558. The input chroma image width and height in pixels.
  3559. @item hsub
  3560. @item vsub
  3561. The horizontal and vertical chroma subsample values. For example, for the
  3562. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3563. @end table
  3564. @item luma_power, lp
  3565. @item chroma_power, cp
  3566. @item alpha_power, ap
  3567. Specify how many times the boxblur filter is applied to the
  3568. corresponding plane.
  3569. Default value for @option{luma_power} is 2. If not specified,
  3570. @option{chroma_power} and @option{alpha_power} default to the
  3571. corresponding value set for @option{luma_power}.
  3572. A value of 0 will disable the effect.
  3573. @end table
  3574. @subsection Examples
  3575. @itemize
  3576. @item
  3577. Apply a boxblur filter with the luma, chroma, and alpha radii
  3578. set to 2:
  3579. @example
  3580. boxblur=luma_radius=2:luma_power=1
  3581. boxblur=2:1
  3582. @end example
  3583. @item
  3584. Set the luma radius to 2, and alpha and chroma radius to 0:
  3585. @example
  3586. boxblur=2:1:cr=0:ar=0
  3587. @end example
  3588. @item
  3589. Set the luma and chroma radii to a fraction of the video dimension:
  3590. @example
  3591. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3592. @end example
  3593. @end itemize
  3594. @section bwdif
  3595. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3596. Deinterlacing Filter").
  3597. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3598. interpolation algorithms.
  3599. It accepts the following parameters:
  3600. @table @option
  3601. @item mode
  3602. The interlacing mode to adopt. It accepts one of the following values:
  3603. @table @option
  3604. @item 0, send_frame
  3605. Output one frame for each frame.
  3606. @item 1, send_field
  3607. Output one frame for each field.
  3608. @end table
  3609. The default value is @code{send_field}.
  3610. @item parity
  3611. The picture field parity assumed for the input interlaced video. It accepts one
  3612. of the following values:
  3613. @table @option
  3614. @item 0, tff
  3615. Assume the top field is first.
  3616. @item 1, bff
  3617. Assume the bottom field is first.
  3618. @item -1, auto
  3619. Enable automatic detection of field parity.
  3620. @end table
  3621. The default value is @code{auto}.
  3622. If the interlacing is unknown or the decoder does not export this information,
  3623. top field first will be assumed.
  3624. @item deint
  3625. Specify which frames to deinterlace. Accept one of the following
  3626. values:
  3627. @table @option
  3628. @item 0, all
  3629. Deinterlace all frames.
  3630. @item 1, interlaced
  3631. Only deinterlace frames marked as interlaced.
  3632. @end table
  3633. The default value is @code{all}.
  3634. @end table
  3635. @section chromakey
  3636. YUV colorspace color/chroma keying.
  3637. The filter accepts the following options:
  3638. @table @option
  3639. @item color
  3640. The color which will be replaced with transparency.
  3641. @item similarity
  3642. Similarity percentage with the key color.
  3643. 0.01 matches only the exact key color, while 1.0 matches everything.
  3644. @item blend
  3645. Blend percentage.
  3646. 0.0 makes pixels either fully transparent, or not transparent at all.
  3647. Higher values result in semi-transparent pixels, with a higher transparency
  3648. the more similar the pixels color is to the key color.
  3649. @item yuv
  3650. Signals that the color passed is already in YUV instead of RGB.
  3651. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3652. This can be used to pass exact YUV values as hexadecimal numbers.
  3653. @end table
  3654. @subsection Examples
  3655. @itemize
  3656. @item
  3657. Make every green pixel in the input image transparent:
  3658. @example
  3659. ffmpeg -i input.png -vf chromakey=green out.png
  3660. @end example
  3661. @item
  3662. Overlay a greenscreen-video on top of a static black background.
  3663. @example
  3664. 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
  3665. @end example
  3666. @end itemize
  3667. @section ciescope
  3668. Display CIE color diagram with pixels overlaid onto it.
  3669. The filter acccepts the following options:
  3670. @table @option
  3671. @item system
  3672. Set color system.
  3673. @table @samp
  3674. @item ntsc, 470m
  3675. @item ebu, 470bg
  3676. @item smpte
  3677. @item 240m
  3678. @item apple
  3679. @item widergb
  3680. @item cie1931
  3681. @item rec709, hdtv
  3682. @item uhdtv, rec2020
  3683. @end table
  3684. @item cie
  3685. Set CIE system.
  3686. @table @samp
  3687. @item xyy
  3688. @item ucs
  3689. @item luv
  3690. @end table
  3691. @item gamuts
  3692. Set what gamuts to draw.
  3693. See @code{system} option for avaiable values.
  3694. @item size, s
  3695. Set ciescope size, by default set to 512.
  3696. @item intensity, i
  3697. Set intensity used to map input pixel values to CIE diagram.
  3698. @item contrast
  3699. Set contrast used to draw tongue colors that are out of active color system gamut.
  3700. @item corrgamma
  3701. Correct gamma displayed on scope, by default enabled.
  3702. @item showwhite
  3703. Show white point on CIE diagram, by default disabled.
  3704. @item gamma
  3705. Set input gamma. Used only with XYZ input color space.
  3706. @end table
  3707. @section codecview
  3708. Visualize information exported by some codecs.
  3709. Some codecs can export information through frames using side-data or other
  3710. means. For example, some MPEG based codecs export motion vectors through the
  3711. @var{export_mvs} flag in the codec @option{flags2} option.
  3712. The filter accepts the following option:
  3713. @table @option
  3714. @item mv
  3715. Set motion vectors to visualize.
  3716. Available flags for @var{mv} are:
  3717. @table @samp
  3718. @item pf
  3719. forward predicted MVs of P-frames
  3720. @item bf
  3721. forward predicted MVs of B-frames
  3722. @item bb
  3723. backward predicted MVs of B-frames
  3724. @end table
  3725. @item qp
  3726. Display quantization parameters using the chroma planes.
  3727. @item mv_type, mvt
  3728. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3729. Available flags for @var{mv_type} are:
  3730. @table @samp
  3731. @item fp
  3732. forward predicted MVs
  3733. @item bp
  3734. backward predicted MVs
  3735. @end table
  3736. @item frame_type, ft
  3737. Set frame type to visualize motion vectors of.
  3738. Available flags for @var{frame_type} are:
  3739. @table @samp
  3740. @item if
  3741. intra-coded frames (I-frames)
  3742. @item pf
  3743. predicted frames (P-frames)
  3744. @item bf
  3745. bi-directionally predicted frames (B-frames)
  3746. @end table
  3747. @end table
  3748. @subsection Examples
  3749. @itemize
  3750. @item
  3751. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3752. @example
  3753. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3754. @end example
  3755. @item
  3756. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3757. @example
  3758. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3759. @end example
  3760. @end itemize
  3761. @section colorbalance
  3762. Modify intensity of primary colors (red, green and blue) of input frames.
  3763. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3764. regions for the red-cyan, green-magenta or blue-yellow balance.
  3765. A positive adjustment value shifts the balance towards the primary color, a negative
  3766. value towards the complementary color.
  3767. The filter accepts the following options:
  3768. @table @option
  3769. @item rs
  3770. @item gs
  3771. @item bs
  3772. Adjust red, green and blue shadows (darkest pixels).
  3773. @item rm
  3774. @item gm
  3775. @item bm
  3776. Adjust red, green and blue midtones (medium pixels).
  3777. @item rh
  3778. @item gh
  3779. @item bh
  3780. Adjust red, green and blue highlights (brightest pixels).
  3781. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3782. @end table
  3783. @subsection Examples
  3784. @itemize
  3785. @item
  3786. Add red color cast to shadows:
  3787. @example
  3788. colorbalance=rs=.3
  3789. @end example
  3790. @end itemize
  3791. @section colorkey
  3792. RGB colorspace color keying.
  3793. The filter accepts the following options:
  3794. @table @option
  3795. @item color
  3796. The color which will be replaced with transparency.
  3797. @item similarity
  3798. Similarity percentage with the key color.
  3799. 0.01 matches only the exact key color, while 1.0 matches everything.
  3800. @item blend
  3801. Blend percentage.
  3802. 0.0 makes pixels either fully transparent, or not transparent at all.
  3803. Higher values result in semi-transparent pixels, with a higher transparency
  3804. the more similar the pixels color is to the key color.
  3805. @end table
  3806. @subsection Examples
  3807. @itemize
  3808. @item
  3809. Make every green pixel in the input image transparent:
  3810. @example
  3811. ffmpeg -i input.png -vf colorkey=green out.png
  3812. @end example
  3813. @item
  3814. Overlay a greenscreen-video on top of a static background image.
  3815. @example
  3816. 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
  3817. @end example
  3818. @end itemize
  3819. @section colorlevels
  3820. Adjust video input frames using levels.
  3821. The filter accepts the following options:
  3822. @table @option
  3823. @item rimin
  3824. @item gimin
  3825. @item bimin
  3826. @item aimin
  3827. Adjust red, green, blue and alpha input black point.
  3828. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3829. @item rimax
  3830. @item gimax
  3831. @item bimax
  3832. @item aimax
  3833. Adjust red, green, blue and alpha input white point.
  3834. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3835. Input levels are used to lighten highlights (bright tones), darken shadows
  3836. (dark tones), change the balance of bright and dark tones.
  3837. @item romin
  3838. @item gomin
  3839. @item bomin
  3840. @item aomin
  3841. Adjust red, green, blue and alpha output black point.
  3842. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3843. @item romax
  3844. @item gomax
  3845. @item bomax
  3846. @item aomax
  3847. Adjust red, green, blue and alpha output white point.
  3848. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3849. Output levels allows manual selection of a constrained output level range.
  3850. @end table
  3851. @subsection Examples
  3852. @itemize
  3853. @item
  3854. Make video output darker:
  3855. @example
  3856. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3857. @end example
  3858. @item
  3859. Increase contrast:
  3860. @example
  3861. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3862. @end example
  3863. @item
  3864. Make video output lighter:
  3865. @example
  3866. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3867. @end example
  3868. @item
  3869. Increase brightness:
  3870. @example
  3871. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3872. @end example
  3873. @end itemize
  3874. @section colorchannelmixer
  3875. Adjust video input frames by re-mixing color channels.
  3876. This filter modifies a color channel by adding the values associated to
  3877. the other channels of the same pixels. For example if the value to
  3878. modify is red, the output value will be:
  3879. @example
  3880. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3881. @end example
  3882. The filter accepts the following options:
  3883. @table @option
  3884. @item rr
  3885. @item rg
  3886. @item rb
  3887. @item ra
  3888. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3889. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3890. @item gr
  3891. @item gg
  3892. @item gb
  3893. @item ga
  3894. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3895. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3896. @item br
  3897. @item bg
  3898. @item bb
  3899. @item ba
  3900. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3901. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3902. @item ar
  3903. @item ag
  3904. @item ab
  3905. @item aa
  3906. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3907. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3908. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3909. @end table
  3910. @subsection Examples
  3911. @itemize
  3912. @item
  3913. Convert source to grayscale:
  3914. @example
  3915. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3916. @end example
  3917. @item
  3918. Simulate sepia tones:
  3919. @example
  3920. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3921. @end example
  3922. @end itemize
  3923. @section colormatrix
  3924. Convert color matrix.
  3925. The filter accepts the following options:
  3926. @table @option
  3927. @item src
  3928. @item dst
  3929. Specify the source and destination color matrix. Both values must be
  3930. specified.
  3931. The accepted values are:
  3932. @table @samp
  3933. @item bt709
  3934. BT.709
  3935. @item bt601
  3936. BT.601
  3937. @item smpte240m
  3938. SMPTE-240M
  3939. @item fcc
  3940. FCC
  3941. @item bt2020
  3942. BT.2020
  3943. @end table
  3944. @end table
  3945. For example to convert from BT.601 to SMPTE-240M, use the command:
  3946. @example
  3947. colormatrix=bt601:smpte240m
  3948. @end example
  3949. @section colorspace
  3950. Convert colorspace, transfer characteristics or color primaries.
  3951. The filter accepts the following options:
  3952. @table @option
  3953. @item all
  3954. Specify all color properties at once.
  3955. The accepted values are:
  3956. @table @samp
  3957. @item bt470m
  3958. BT.470M
  3959. @item bt470bg
  3960. BT.470BG
  3961. @item bt601-6-525
  3962. BT.601-6 525
  3963. @item bt601-6-625
  3964. BT.601-6 625
  3965. @item bt709
  3966. BT.709
  3967. @item smpte170m
  3968. SMPTE-170M
  3969. @item smpte240m
  3970. SMPTE-240M
  3971. @item bt2020
  3972. BT.2020
  3973. @end table
  3974. @item space
  3975. Specify output colorspace.
  3976. The accepted values are:
  3977. @table @samp
  3978. @item bt709
  3979. BT.709
  3980. @item fcc
  3981. FCC
  3982. @item bt470bg
  3983. BT.470BG or BT.601-6 625
  3984. @item smpte170m
  3985. SMPTE-170M or BT.601-6 525
  3986. @item smpte240m
  3987. SMPTE-240M
  3988. @item bt2020ncl
  3989. BT.2020 with non-constant luminance
  3990. @end table
  3991. @item trc
  3992. Specify output transfer characteristics.
  3993. The accepted values are:
  3994. @table @samp
  3995. @item bt709
  3996. BT.709
  3997. @item gamma22
  3998. Constant gamma of 2.2
  3999. @item gamma28
  4000. Constant gamma of 2.8
  4001. @item smpte170m
  4002. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4003. @item smpte240m
  4004. SMPTE-240M
  4005. @item bt2020-10
  4006. BT.2020 for 10-bits content
  4007. @item bt2020-12
  4008. BT.2020 for 12-bits content
  4009. @end table
  4010. @item prm
  4011. Specify output color primaries.
  4012. The accepted values are:
  4013. @table @samp
  4014. @item bt709
  4015. BT.709
  4016. @item bt470m
  4017. BT.470M
  4018. @item bt470bg
  4019. BT.470BG or BT.601-6 625
  4020. @item smpte170m
  4021. SMPTE-170M or BT.601-6 525
  4022. @item smpte240m
  4023. SMPTE-240M
  4024. @item bt2020
  4025. BT.2020
  4026. @end table
  4027. @item rng
  4028. Specify output color range.
  4029. The accepted values are:
  4030. @table @samp
  4031. @item mpeg
  4032. MPEG (restricted) range
  4033. @item jpeg
  4034. JPEG (full) range
  4035. @end table
  4036. @item format
  4037. Specify output color format.
  4038. The accepted values are:
  4039. @table @samp
  4040. @item yuv420p
  4041. YUV 4:2:0 planar 8-bits
  4042. @item yuv420p10
  4043. YUV 4:2:0 planar 10-bits
  4044. @item yuv420p12
  4045. YUV 4:2:0 planar 12-bits
  4046. @item yuv422p
  4047. YUV 4:2:2 planar 8-bits
  4048. @item yuv422p10
  4049. YUV 4:2:2 planar 10-bits
  4050. @item yuv422p12
  4051. YUV 4:2:2 planar 12-bits
  4052. @item yuv444p
  4053. YUV 4:4:4 planar 8-bits
  4054. @item yuv444p10
  4055. YUV 4:4:4 planar 10-bits
  4056. @item yuv444p12
  4057. YUV 4:4:4 planar 12-bits
  4058. @end table
  4059. @item fast
  4060. Do a fast conversion, which skips gamma/primary correction. This will take
  4061. significantly less CPU, but will be mathematically incorrect. To get output
  4062. compatible with that produced by the colormatrix filter, use fast=1.
  4063. @item dither
  4064. Specify dithering mode.
  4065. The accepted values are:
  4066. @table @samp
  4067. @item none
  4068. No dithering
  4069. @item fsb
  4070. Floyd-Steinberg dithering
  4071. @end table
  4072. @item wpadapt
  4073. Whitepoint adaptation mode.
  4074. The accepted values are:
  4075. @table @samp
  4076. @item bradford
  4077. Bradford whitepoint adaptation
  4078. @item vonkries
  4079. von Kries whitepoint adaptation
  4080. @item identity
  4081. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4082. @end table
  4083. @end table
  4084. The filter converts the transfer characteristics, color space and color
  4085. primaries to the specified user values. The output value, if not specified,
  4086. is set to a default value based on the "all" property. If that property is
  4087. also not specified, the filter will log an error. The output color range and
  4088. format default to the same value as the input color range and format. The
  4089. input transfer characteristics, color space, color primaries and color range
  4090. should be set on the input data. If any of these are missing, the filter will
  4091. log an error and no conversion will take place.
  4092. For example to convert the input to SMPTE-240M, use the command:
  4093. @example
  4094. colorspace=smpte240m
  4095. @end example
  4096. @section convolution
  4097. Apply convolution 3x3 or 5x5 filter.
  4098. The filter accepts the following options:
  4099. @table @option
  4100. @item 0m
  4101. @item 1m
  4102. @item 2m
  4103. @item 3m
  4104. Set matrix for each plane.
  4105. Matrix is sequence of 9 or 25 signed integers.
  4106. @item 0rdiv
  4107. @item 1rdiv
  4108. @item 2rdiv
  4109. @item 3rdiv
  4110. Set multiplier for calculated value for each plane.
  4111. @item 0bias
  4112. @item 1bias
  4113. @item 2bias
  4114. @item 3bias
  4115. Set bias for each plane. This value is added to the result of the multiplication.
  4116. Useful for making the overall image brighter or darker. Default is 0.0.
  4117. @end table
  4118. @subsection Examples
  4119. @itemize
  4120. @item
  4121. Apply sharpen:
  4122. @example
  4123. 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"
  4124. @end example
  4125. @item
  4126. Apply blur:
  4127. @example
  4128. 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"
  4129. @end example
  4130. @item
  4131. Apply edge enhance:
  4132. @example
  4133. 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"
  4134. @end example
  4135. @item
  4136. Apply edge detect:
  4137. @example
  4138. 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"
  4139. @end example
  4140. @item
  4141. Apply emboss:
  4142. @example
  4143. 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"
  4144. @end example
  4145. @end itemize
  4146. @section copy
  4147. Copy the input source unchanged to the output. This is mainly useful for
  4148. testing purposes.
  4149. @anchor{coreimage}
  4150. @section coreimage
  4151. Video filtering on GPU using Apple's CoreImage API on OSX.
  4152. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4153. processed by video hardware. However, software-based OpenGL implementations
  4154. exist which means there is no guarantee for hardware processing. It depends on
  4155. the respective OSX.
  4156. There are many filters and image generators provided by Apple that come with a
  4157. large variety of options. The filter has to be referenced by its name along
  4158. with its options.
  4159. The coreimage filter accepts the following options:
  4160. @table @option
  4161. @item list_filters
  4162. List all available filters and generators along with all their respective
  4163. options as well as possible minimum and maximum values along with the default
  4164. values.
  4165. @example
  4166. list_filters=true
  4167. @end example
  4168. @item filter
  4169. Specify all filters by their respective name and options.
  4170. Use @var{list_filters} to determine all valid filter names and options.
  4171. Numerical options are specified by a float value and are automatically clamped
  4172. to their respective value range. Vector and color options have to be specified
  4173. by a list of space separated float values. Character escaping has to be done.
  4174. A special option name @code{default} is available to use default options for a
  4175. filter.
  4176. It is required to specify either @code{default} or at least one of the filter options.
  4177. All omitted options are used with their default values.
  4178. The syntax of the filter string is as follows:
  4179. @example
  4180. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4181. @end example
  4182. @item output_rect
  4183. Specify a rectangle where the output of the filter chain is copied into the
  4184. input image. It is given by a list of space separated float values:
  4185. @example
  4186. output_rect=x\ y\ width\ height
  4187. @end example
  4188. If not given, the output rectangle equals the dimensions of the input image.
  4189. The output rectangle is automatically cropped at the borders of the input
  4190. image. Negative values are valid for each component.
  4191. @example
  4192. output_rect=25\ 25\ 100\ 100
  4193. @end example
  4194. @end table
  4195. Several filters can be chained for successive processing without GPU-HOST
  4196. transfers allowing for fast processing of complex filter chains.
  4197. Currently, only filters with zero (generators) or exactly one (filters) input
  4198. image and one output image are supported. Also, transition filters are not yet
  4199. usable as intended.
  4200. Some filters generate output images with additional padding depending on the
  4201. respective filter kernel. The padding is automatically removed to ensure the
  4202. filter output has the same size as the input image.
  4203. For image generators, the size of the output image is determined by the
  4204. previous output image of the filter chain or the input image of the whole
  4205. filterchain, respectively. The generators do not use the pixel information of
  4206. this image to generate their output. However, the generated output is
  4207. blended onto this image, resulting in partial or complete coverage of the
  4208. output image.
  4209. The @ref{coreimagesrc} video source can be used for generating input images
  4210. which are directly fed into the filter chain. By using it, providing input
  4211. images by another video source or an input video is not required.
  4212. @subsection Examples
  4213. @itemize
  4214. @item
  4215. List all filters available:
  4216. @example
  4217. coreimage=list_filters=true
  4218. @end example
  4219. @item
  4220. Use the CIBoxBlur filter with default options to blur an image:
  4221. @example
  4222. coreimage=filter=CIBoxBlur@@default
  4223. @end example
  4224. @item
  4225. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4226. its center at 100x100 and a radius of 50 pixels:
  4227. @example
  4228. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4229. @end example
  4230. @item
  4231. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4232. given as complete and escaped command-line for Apple's standard bash shell:
  4233. @example
  4234. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4235. @end example
  4236. @end itemize
  4237. @section crop
  4238. Crop the input video to given dimensions.
  4239. It accepts the following parameters:
  4240. @table @option
  4241. @item w, out_w
  4242. The width of the output video. It defaults to @code{iw}.
  4243. This expression is evaluated only once during the filter
  4244. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4245. @item h, out_h
  4246. The height of the output video. It defaults to @code{ih}.
  4247. This expression is evaluated only once during the filter
  4248. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4249. @item x
  4250. The horizontal position, in the input video, of the left edge of the output
  4251. video. It defaults to @code{(in_w-out_w)/2}.
  4252. This expression is evaluated per-frame.
  4253. @item y
  4254. The vertical position, in the input video, of the top edge of the output video.
  4255. It defaults to @code{(in_h-out_h)/2}.
  4256. This expression is evaluated per-frame.
  4257. @item keep_aspect
  4258. If set to 1 will force the output display aspect ratio
  4259. to be the same of the input, by changing the output sample aspect
  4260. ratio. It defaults to 0.
  4261. @end table
  4262. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4263. expressions containing the following constants:
  4264. @table @option
  4265. @item x
  4266. @item y
  4267. The computed values for @var{x} and @var{y}. They are evaluated for
  4268. each new frame.
  4269. @item in_w
  4270. @item in_h
  4271. The input width and height.
  4272. @item iw
  4273. @item ih
  4274. These are the same as @var{in_w} and @var{in_h}.
  4275. @item out_w
  4276. @item out_h
  4277. The output (cropped) width and height.
  4278. @item ow
  4279. @item oh
  4280. These are the same as @var{out_w} and @var{out_h}.
  4281. @item a
  4282. same as @var{iw} / @var{ih}
  4283. @item sar
  4284. input sample aspect ratio
  4285. @item dar
  4286. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4287. @item hsub
  4288. @item vsub
  4289. horizontal and vertical chroma subsample values. For example for the
  4290. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4291. @item n
  4292. The number of the input frame, starting from 0.
  4293. @item pos
  4294. the position in the file of the input frame, NAN if unknown
  4295. @item t
  4296. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4297. @end table
  4298. The expression for @var{out_w} may depend on the value of @var{out_h},
  4299. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4300. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4301. evaluated after @var{out_w} and @var{out_h}.
  4302. The @var{x} and @var{y} parameters specify the expressions for the
  4303. position of the top-left corner of the output (non-cropped) area. They
  4304. are evaluated for each frame. If the evaluated value is not valid, it
  4305. is approximated to the nearest valid value.
  4306. The expression for @var{x} may depend on @var{y}, and the expression
  4307. for @var{y} may depend on @var{x}.
  4308. @subsection Examples
  4309. @itemize
  4310. @item
  4311. Crop area with size 100x100 at position (12,34).
  4312. @example
  4313. crop=100:100:12:34
  4314. @end example
  4315. Using named options, the example above becomes:
  4316. @example
  4317. crop=w=100:h=100:x=12:y=34
  4318. @end example
  4319. @item
  4320. Crop the central input area with size 100x100:
  4321. @example
  4322. crop=100:100
  4323. @end example
  4324. @item
  4325. Crop the central input area with size 2/3 of the input video:
  4326. @example
  4327. crop=2/3*in_w:2/3*in_h
  4328. @end example
  4329. @item
  4330. Crop the input video central square:
  4331. @example
  4332. crop=out_w=in_h
  4333. crop=in_h
  4334. @end example
  4335. @item
  4336. Delimit the rectangle with the top-left corner placed at position
  4337. 100:100 and the right-bottom corner corresponding to the right-bottom
  4338. corner of the input image.
  4339. @example
  4340. crop=in_w-100:in_h-100:100:100
  4341. @end example
  4342. @item
  4343. Crop 10 pixels from the left and right borders, and 20 pixels from
  4344. the top and bottom borders
  4345. @example
  4346. crop=in_w-2*10:in_h-2*20
  4347. @end example
  4348. @item
  4349. Keep only the bottom right quarter of the input image:
  4350. @example
  4351. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4352. @end example
  4353. @item
  4354. Crop height for getting Greek harmony:
  4355. @example
  4356. crop=in_w:1/PHI*in_w
  4357. @end example
  4358. @item
  4359. Apply trembling effect:
  4360. @example
  4361. 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)
  4362. @end example
  4363. @item
  4364. Apply erratic camera effect depending on timestamp:
  4365. @example
  4366. 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)"
  4367. @end example
  4368. @item
  4369. Set x depending on the value of y:
  4370. @example
  4371. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4372. @end example
  4373. @end itemize
  4374. @subsection Commands
  4375. This filter supports the following commands:
  4376. @table @option
  4377. @item w, out_w
  4378. @item h, out_h
  4379. @item x
  4380. @item y
  4381. Set width/height of the output video and the horizontal/vertical position
  4382. in the input video.
  4383. The command accepts the same syntax of the corresponding option.
  4384. If the specified expression is not valid, it is kept at its current
  4385. value.
  4386. @end table
  4387. @section cropdetect
  4388. Auto-detect the crop size.
  4389. It calculates the necessary cropping parameters and prints the
  4390. recommended parameters via the logging system. The detected dimensions
  4391. correspond to the non-black area of the input video.
  4392. It accepts the following parameters:
  4393. @table @option
  4394. @item limit
  4395. Set higher black value threshold, which can be optionally specified
  4396. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4397. value greater to the set value is considered non-black. It defaults to 24.
  4398. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4399. on the bitdepth of the pixel format.
  4400. @item round
  4401. The value which the width/height should be divisible by. It defaults to
  4402. 16. The offset is automatically adjusted to center the video. Use 2 to
  4403. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4404. encoding to most video codecs.
  4405. @item reset_count, reset
  4406. Set the counter that determines after how many frames cropdetect will
  4407. reset the previously detected largest video area and start over to
  4408. detect the current optimal crop area. Default value is 0.
  4409. This can be useful when channel logos distort the video area. 0
  4410. indicates 'never reset', and returns the largest area encountered during
  4411. playback.
  4412. @end table
  4413. @anchor{curves}
  4414. @section curves
  4415. Apply color adjustments using curves.
  4416. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4417. component (red, green and blue) has its values defined by @var{N} key points
  4418. tied from each other using a smooth curve. The x-axis represents the pixel
  4419. values from the input frame, and the y-axis the new pixel values to be set for
  4420. the output frame.
  4421. By default, a component curve is defined by the two points @var{(0;0)} and
  4422. @var{(1;1)}. This creates a straight line where each original pixel value is
  4423. "adjusted" to its own value, which means no change to the image.
  4424. The filter allows you to redefine these two points and add some more. A new
  4425. curve (using a natural cubic spline interpolation) will be define to pass
  4426. smoothly through all these new coordinates. The new defined points needs to be
  4427. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4428. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4429. the vector spaces, the values will be clipped accordingly.
  4430. If there is no key point defined in @code{x=0}, the filter will automatically
  4431. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  4432. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  4433. The filter accepts the following options:
  4434. @table @option
  4435. @item preset
  4436. Select one of the available color presets. This option can be used in addition
  4437. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4438. options takes priority on the preset values.
  4439. Available presets are:
  4440. @table @samp
  4441. @item none
  4442. @item color_negative
  4443. @item cross_process
  4444. @item darker
  4445. @item increase_contrast
  4446. @item lighter
  4447. @item linear_contrast
  4448. @item medium_contrast
  4449. @item negative
  4450. @item strong_contrast
  4451. @item vintage
  4452. @end table
  4453. Default is @code{none}.
  4454. @item master, m
  4455. Set the master key points. These points will define a second pass mapping. It
  4456. is sometimes called a "luminance" or "value" mapping. It can be used with
  4457. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4458. post-processing LUT.
  4459. @item red, r
  4460. Set the key points for the red component.
  4461. @item green, g
  4462. Set the key points for the green component.
  4463. @item blue, b
  4464. Set the key points for the blue component.
  4465. @item all
  4466. Set the key points for all components (not including master).
  4467. Can be used in addition to the other key points component
  4468. options. In this case, the unset component(s) will fallback on this
  4469. @option{all} setting.
  4470. @item psfile
  4471. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4472. @end table
  4473. To avoid some filtergraph syntax conflicts, each key points list need to be
  4474. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4475. @subsection Examples
  4476. @itemize
  4477. @item
  4478. Increase slightly the middle level of blue:
  4479. @example
  4480. curves=blue='0.5/0.58'
  4481. @end example
  4482. @item
  4483. Vintage effect:
  4484. @example
  4485. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  4486. @end example
  4487. Here we obtain the following coordinates for each components:
  4488. @table @var
  4489. @item red
  4490. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4491. @item green
  4492. @code{(0;0) (0.50;0.48) (1;1)}
  4493. @item blue
  4494. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4495. @end table
  4496. @item
  4497. The previous example can also be achieved with the associated built-in preset:
  4498. @example
  4499. curves=preset=vintage
  4500. @end example
  4501. @item
  4502. Or simply:
  4503. @example
  4504. curves=vintage
  4505. @end example
  4506. @item
  4507. Use a Photoshop preset and redefine the points of the green component:
  4508. @example
  4509. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  4510. @end example
  4511. @end itemize
  4512. @section datascope
  4513. Video data analysis filter.
  4514. This filter shows hexadecimal pixel values of part of video.
  4515. The filter accepts the following options:
  4516. @table @option
  4517. @item size, s
  4518. Set output video size.
  4519. @item x
  4520. Set x offset from where to pick pixels.
  4521. @item y
  4522. Set y offset from where to pick pixels.
  4523. @item mode
  4524. Set scope mode, can be one of the following:
  4525. @table @samp
  4526. @item mono
  4527. Draw hexadecimal pixel values with white color on black background.
  4528. @item color
  4529. Draw hexadecimal pixel values with input video pixel color on black
  4530. background.
  4531. @item color2
  4532. Draw hexadecimal pixel values on color background picked from input video,
  4533. the text color is picked in such way so its always visible.
  4534. @end table
  4535. @item axis
  4536. Draw rows and columns numbers on left and top of video.
  4537. @end table
  4538. @section dctdnoiz
  4539. Denoise frames using 2D DCT (frequency domain filtering).
  4540. This filter is not designed for real time.
  4541. The filter accepts the following options:
  4542. @table @option
  4543. @item sigma, s
  4544. Set the noise sigma constant.
  4545. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4546. coefficient (absolute value) below this threshold with be dropped.
  4547. If you need a more advanced filtering, see @option{expr}.
  4548. Default is @code{0}.
  4549. @item overlap
  4550. Set number overlapping pixels for each block. Since the filter can be slow, you
  4551. may want to reduce this value, at the cost of a less effective filter and the
  4552. risk of various artefacts.
  4553. If the overlapping value doesn't permit processing the whole input width or
  4554. height, a warning will be displayed and according borders won't be denoised.
  4555. Default value is @var{blocksize}-1, which is the best possible setting.
  4556. @item expr, e
  4557. Set the coefficient factor expression.
  4558. For each coefficient of a DCT block, this expression will be evaluated as a
  4559. multiplier value for the coefficient.
  4560. If this is option is set, the @option{sigma} option will be ignored.
  4561. The absolute value of the coefficient can be accessed through the @var{c}
  4562. variable.
  4563. @item n
  4564. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4565. @var{blocksize}, which is the width and height of the processed blocks.
  4566. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4567. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4568. on the speed processing. Also, a larger block size does not necessarily means a
  4569. better de-noising.
  4570. @end table
  4571. @subsection Examples
  4572. Apply a denoise with a @option{sigma} of @code{4.5}:
  4573. @example
  4574. dctdnoiz=4.5
  4575. @end example
  4576. The same operation can be achieved using the expression system:
  4577. @example
  4578. dctdnoiz=e='gte(c, 4.5*3)'
  4579. @end example
  4580. Violent denoise using a block size of @code{16x16}:
  4581. @example
  4582. dctdnoiz=15:n=4
  4583. @end example
  4584. @section deband
  4585. Remove banding artifacts from input video.
  4586. It works by replacing banded pixels with average value of referenced pixels.
  4587. The filter accepts the following options:
  4588. @table @option
  4589. @item 1thr
  4590. @item 2thr
  4591. @item 3thr
  4592. @item 4thr
  4593. Set banding detection threshold for each plane. Default is 0.02.
  4594. Valid range is 0.00003 to 0.5.
  4595. If difference between current pixel and reference pixel is less than threshold,
  4596. it will be considered as banded.
  4597. @item range, r
  4598. Banding detection range in pixels. Default is 16. If positive, random number
  4599. in range 0 to set value will be used. If negative, exact absolute value
  4600. will be used.
  4601. The range defines square of four pixels around current pixel.
  4602. @item direction, d
  4603. Set direction in radians from which four pixel will be compared. If positive,
  4604. random direction from 0 to set direction will be picked. If negative, exact of
  4605. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4606. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4607. column.
  4608. @item blur
  4609. If enabled, current pixel is compared with average value of all four
  4610. surrounding pixels. The default is enabled. If disabled current pixel is
  4611. compared with all four surrounding pixels. The pixel is considered banded
  4612. if only all four differences with surrounding pixels are less than threshold.
  4613. @end table
  4614. @anchor{decimate}
  4615. @section decimate
  4616. Drop duplicated frames at regular intervals.
  4617. The filter accepts the following options:
  4618. @table @option
  4619. @item cycle
  4620. Set the number of frames from which one will be dropped. Setting this to
  4621. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4622. Default is @code{5}.
  4623. @item dupthresh
  4624. Set the threshold for duplicate detection. If the difference metric for a frame
  4625. is less than or equal to this value, then it is declared as duplicate. Default
  4626. is @code{1.1}
  4627. @item scthresh
  4628. Set scene change threshold. Default is @code{15}.
  4629. @item blockx
  4630. @item blocky
  4631. Set the size of the x and y-axis blocks used during metric calculations.
  4632. Larger blocks give better noise suppression, but also give worse detection of
  4633. small movements. Must be a power of two. Default is @code{32}.
  4634. @item ppsrc
  4635. Mark main input as a pre-processed input and activate clean source input
  4636. stream. This allows the input to be pre-processed with various filters to help
  4637. the metrics calculation while keeping the frame selection lossless. When set to
  4638. @code{1}, the first stream is for the pre-processed input, and the second
  4639. stream is the clean source from where the kept frames are chosen. Default is
  4640. @code{0}.
  4641. @item chroma
  4642. Set whether or not chroma is considered in the metric calculations. Default is
  4643. @code{1}.
  4644. @end table
  4645. @section deflate
  4646. Apply deflate effect to the video.
  4647. This filter replaces the pixel by the local(3x3) average by taking into account
  4648. only values lower than the pixel.
  4649. It accepts the following options:
  4650. @table @option
  4651. @item threshold0
  4652. @item threshold1
  4653. @item threshold2
  4654. @item threshold3
  4655. Limit the maximum change for each plane, default is 65535.
  4656. If 0, plane will remain unchanged.
  4657. @end table
  4658. @section dejudder
  4659. Remove judder produced by partially interlaced telecined content.
  4660. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4661. source was partially telecined content then the output of @code{pullup,dejudder}
  4662. will have a variable frame rate. May change the recorded frame rate of the
  4663. container. Aside from that change, this filter will not affect constant frame
  4664. rate video.
  4665. The option available in this filter is:
  4666. @table @option
  4667. @item cycle
  4668. Specify the length of the window over which the judder repeats.
  4669. Accepts any integer greater than 1. Useful values are:
  4670. @table @samp
  4671. @item 4
  4672. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4673. @item 5
  4674. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4675. @item 20
  4676. If a mixture of the two.
  4677. @end table
  4678. The default is @samp{4}.
  4679. @end table
  4680. @section delogo
  4681. Suppress a TV station logo by a simple interpolation of the surrounding
  4682. pixels. Just set a rectangle covering the logo and watch it disappear
  4683. (and sometimes something even uglier appear - your mileage may vary).
  4684. It accepts the following parameters:
  4685. @table @option
  4686. @item x
  4687. @item y
  4688. Specify the top left corner coordinates of the logo. They must be
  4689. specified.
  4690. @item w
  4691. @item h
  4692. Specify the width and height of the logo to clear. They must be
  4693. specified.
  4694. @item band, t
  4695. Specify the thickness of the fuzzy edge of the rectangle (added to
  4696. @var{w} and @var{h}). The default value is 1. This option is
  4697. deprecated, setting higher values should no longer be necessary and
  4698. is not recommended.
  4699. @item show
  4700. When set to 1, a green rectangle is drawn on the screen to simplify
  4701. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4702. The default value is 0.
  4703. The rectangle is drawn on the outermost pixels which will be (partly)
  4704. replaced with interpolated values. The values of the next pixels
  4705. immediately outside this rectangle in each direction will be used to
  4706. compute the interpolated pixel values inside the rectangle.
  4707. @end table
  4708. @subsection Examples
  4709. @itemize
  4710. @item
  4711. Set a rectangle covering the area with top left corner coordinates 0,0
  4712. and size 100x77, and a band of size 10:
  4713. @example
  4714. delogo=x=0:y=0:w=100:h=77:band=10
  4715. @end example
  4716. @end itemize
  4717. @section deshake
  4718. Attempt to fix small changes in horizontal and/or vertical shift. This
  4719. filter helps remove camera shake from hand-holding a camera, bumping a
  4720. tripod, moving on a vehicle, etc.
  4721. The filter accepts the following options:
  4722. @table @option
  4723. @item x
  4724. @item y
  4725. @item w
  4726. @item h
  4727. Specify a rectangular area where to limit the search for motion
  4728. vectors.
  4729. If desired the search for motion vectors can be limited to a
  4730. rectangular area of the frame defined by its top left corner, width
  4731. and height. These parameters have the same meaning as the drawbox
  4732. filter which can be used to visualise the position of the bounding
  4733. box.
  4734. This is useful when simultaneous movement of subjects within the frame
  4735. might be confused for camera motion by the motion vector search.
  4736. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4737. then the full frame is used. This allows later options to be set
  4738. without specifying the bounding box for the motion vector search.
  4739. Default - search the whole frame.
  4740. @item rx
  4741. @item ry
  4742. Specify the maximum extent of movement in x and y directions in the
  4743. range 0-64 pixels. Default 16.
  4744. @item edge
  4745. Specify how to generate pixels to fill blanks at the edge of the
  4746. frame. Available values are:
  4747. @table @samp
  4748. @item blank, 0
  4749. Fill zeroes at blank locations
  4750. @item original, 1
  4751. Original image at blank locations
  4752. @item clamp, 2
  4753. Extruded edge value at blank locations
  4754. @item mirror, 3
  4755. Mirrored edge at blank locations
  4756. @end table
  4757. Default value is @samp{mirror}.
  4758. @item blocksize
  4759. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4760. default 8.
  4761. @item contrast
  4762. Specify the contrast threshold for blocks. Only blocks with more than
  4763. the specified contrast (difference between darkest and lightest
  4764. pixels) will be considered. Range 1-255, default 125.
  4765. @item search
  4766. Specify the search strategy. Available values are:
  4767. @table @samp
  4768. @item exhaustive, 0
  4769. Set exhaustive search
  4770. @item less, 1
  4771. Set less exhaustive search.
  4772. @end table
  4773. Default value is @samp{exhaustive}.
  4774. @item filename
  4775. If set then a detailed log of the motion search is written to the
  4776. specified file.
  4777. @item opencl
  4778. If set to 1, specify using OpenCL capabilities, only available if
  4779. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4780. @end table
  4781. @section detelecine
  4782. Apply an exact inverse of the telecine operation. It requires a predefined
  4783. pattern specified using the pattern option which must be the same as that passed
  4784. to the telecine filter.
  4785. This filter accepts the following options:
  4786. @table @option
  4787. @item first_field
  4788. @table @samp
  4789. @item top, t
  4790. top field first
  4791. @item bottom, b
  4792. bottom field first
  4793. The default value is @code{top}.
  4794. @end table
  4795. @item pattern
  4796. A string of numbers representing the pulldown pattern you wish to apply.
  4797. The default value is @code{23}.
  4798. @item start_frame
  4799. A number representing position of the first frame with respect to the telecine
  4800. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4801. @end table
  4802. @section dilation
  4803. Apply dilation effect to the video.
  4804. This filter replaces the pixel by the local(3x3) maximum.
  4805. It accepts the following options:
  4806. @table @option
  4807. @item threshold0
  4808. @item threshold1
  4809. @item threshold2
  4810. @item threshold3
  4811. Limit the maximum change for each plane, default is 65535.
  4812. If 0, plane will remain unchanged.
  4813. @item coordinates
  4814. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4815. pixels are used.
  4816. Flags to local 3x3 coordinates maps like this:
  4817. 1 2 3
  4818. 4 5
  4819. 6 7 8
  4820. @end table
  4821. @section displace
  4822. Displace pixels as indicated by second and third input stream.
  4823. It takes three input streams and outputs one stream, the first input is the
  4824. source, and second and third input are displacement maps.
  4825. The second input specifies how much to displace pixels along the
  4826. x-axis, while the third input specifies how much to displace pixels
  4827. along the y-axis.
  4828. If one of displacement map streams terminates, last frame from that
  4829. displacement map will be used.
  4830. Note that once generated, displacements maps can be reused over and over again.
  4831. A description of the accepted options follows.
  4832. @table @option
  4833. @item edge
  4834. Set displace behavior for pixels that are out of range.
  4835. Available values are:
  4836. @table @samp
  4837. @item blank
  4838. Missing pixels are replaced by black pixels.
  4839. @item smear
  4840. Adjacent pixels will spread out to replace missing pixels.
  4841. @item wrap
  4842. Out of range pixels are wrapped so they point to pixels of other side.
  4843. @end table
  4844. Default is @samp{smear}.
  4845. @end table
  4846. @subsection Examples
  4847. @itemize
  4848. @item
  4849. Add ripple effect to rgb input of video size hd720:
  4850. @example
  4851. 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
  4852. @end example
  4853. @item
  4854. Add wave effect to rgb input of video size hd720:
  4855. @example
  4856. 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
  4857. @end example
  4858. @end itemize
  4859. @section drawbox
  4860. Draw a colored box on the input image.
  4861. It accepts the following parameters:
  4862. @table @option
  4863. @item x
  4864. @item y
  4865. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4866. @item width, w
  4867. @item height, h
  4868. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4869. the input width and height. It defaults to 0.
  4870. @item color, c
  4871. Specify the color of the box to write. For the general syntax of this option,
  4872. check the "Color" section in the ffmpeg-utils manual. If the special
  4873. value @code{invert} is used, the box edge color is the same as the
  4874. video with inverted luma.
  4875. @item thickness, t
  4876. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4877. See below for the list of accepted constants.
  4878. @end table
  4879. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4880. following constants:
  4881. @table @option
  4882. @item dar
  4883. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4884. @item hsub
  4885. @item vsub
  4886. horizontal and vertical chroma subsample values. For example for the
  4887. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4888. @item in_h, ih
  4889. @item in_w, iw
  4890. The input width and height.
  4891. @item sar
  4892. The input sample aspect ratio.
  4893. @item x
  4894. @item y
  4895. The x and y offset coordinates where the box is drawn.
  4896. @item w
  4897. @item h
  4898. The width and height of the drawn box.
  4899. @item t
  4900. The thickness of the drawn box.
  4901. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4902. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4903. @end table
  4904. @subsection Examples
  4905. @itemize
  4906. @item
  4907. Draw a black box around the edge of the input image:
  4908. @example
  4909. drawbox
  4910. @end example
  4911. @item
  4912. Draw a box with color red and an opacity of 50%:
  4913. @example
  4914. drawbox=10:20:200:60:red@@0.5
  4915. @end example
  4916. The previous example can be specified as:
  4917. @example
  4918. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4919. @end example
  4920. @item
  4921. Fill the box with pink color:
  4922. @example
  4923. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4924. @end example
  4925. @item
  4926. Draw a 2-pixel red 2.40:1 mask:
  4927. @example
  4928. 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
  4929. @end example
  4930. @end itemize
  4931. @section drawgraph, adrawgraph
  4932. Draw a graph using input video or audio metadata.
  4933. It accepts the following parameters:
  4934. @table @option
  4935. @item m1
  4936. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4937. @item fg1
  4938. Set 1st foreground color expression.
  4939. @item m2
  4940. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4941. @item fg2
  4942. Set 2nd foreground color expression.
  4943. @item m3
  4944. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4945. @item fg3
  4946. Set 3rd foreground color expression.
  4947. @item m4
  4948. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4949. @item fg4
  4950. Set 4th foreground color expression.
  4951. @item min
  4952. Set minimal value of metadata value.
  4953. @item max
  4954. Set maximal value of metadata value.
  4955. @item bg
  4956. Set graph background color. Default is white.
  4957. @item mode
  4958. Set graph mode.
  4959. Available values for mode is:
  4960. @table @samp
  4961. @item bar
  4962. @item dot
  4963. @item line
  4964. @end table
  4965. Default is @code{line}.
  4966. @item slide
  4967. Set slide mode.
  4968. Available values for slide is:
  4969. @table @samp
  4970. @item frame
  4971. Draw new frame when right border is reached.
  4972. @item replace
  4973. Replace old columns with new ones.
  4974. @item scroll
  4975. Scroll from right to left.
  4976. @item rscroll
  4977. Scroll from left to right.
  4978. @end table
  4979. Default is @code{frame}.
  4980. @item size
  4981. Set size of graph video. For the syntax of this option, check the
  4982. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4983. The default value is @code{900x256}.
  4984. The foreground color expressions can use the following variables:
  4985. @table @option
  4986. @item MIN
  4987. Minimal value of metadata value.
  4988. @item MAX
  4989. Maximal value of metadata value.
  4990. @item VAL
  4991. Current metadata key value.
  4992. @end table
  4993. The color is defined as 0xAABBGGRR.
  4994. @end table
  4995. Example using metadata from @ref{signalstats} filter:
  4996. @example
  4997. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4998. @end example
  4999. Example using metadata from @ref{ebur128} filter:
  5000. @example
  5001. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  5002. @end example
  5003. @section drawgrid
  5004. Draw a grid on the input image.
  5005. It accepts the following parameters:
  5006. @table @option
  5007. @item x
  5008. @item y
  5009. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5010. @item width, w
  5011. @item height, h
  5012. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5013. input width and height, respectively, minus @code{thickness}, so image gets
  5014. framed. Default to 0.
  5015. @item color, c
  5016. Specify the color of the grid. For the general syntax of this option,
  5017. check the "Color" section in the ffmpeg-utils manual. If the special
  5018. value @code{invert} is used, the grid color is the same as the
  5019. video with inverted luma.
  5020. @item thickness, t
  5021. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5022. See below for the list of accepted constants.
  5023. @end table
  5024. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5025. following constants:
  5026. @table @option
  5027. @item dar
  5028. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5029. @item hsub
  5030. @item vsub
  5031. horizontal and vertical chroma subsample values. For example for the
  5032. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5033. @item in_h, ih
  5034. @item in_w, iw
  5035. The input grid cell width and height.
  5036. @item sar
  5037. The input sample aspect ratio.
  5038. @item x
  5039. @item y
  5040. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5041. @item w
  5042. @item h
  5043. The width and height of the drawn cell.
  5044. @item t
  5045. The thickness of the drawn cell.
  5046. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5047. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5048. @end table
  5049. @subsection Examples
  5050. @itemize
  5051. @item
  5052. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5053. @example
  5054. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5055. @end example
  5056. @item
  5057. Draw a white 3x3 grid with an opacity of 50%:
  5058. @example
  5059. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5060. @end example
  5061. @end itemize
  5062. @anchor{drawtext}
  5063. @section drawtext
  5064. Draw a text string or text from a specified file on top of a video, using the
  5065. libfreetype library.
  5066. To enable compilation of this filter, you need to configure FFmpeg with
  5067. @code{--enable-libfreetype}.
  5068. To enable default font fallback and the @var{font} option you need to
  5069. configure FFmpeg with @code{--enable-libfontconfig}.
  5070. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5071. @code{--enable-libfribidi}.
  5072. @subsection Syntax
  5073. It accepts the following parameters:
  5074. @table @option
  5075. @item box
  5076. Used to draw a box around text using the background color.
  5077. The value must be either 1 (enable) or 0 (disable).
  5078. The default value of @var{box} is 0.
  5079. @item boxborderw
  5080. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5081. The default value of @var{boxborderw} is 0.
  5082. @item boxcolor
  5083. The color to be used for drawing box around text. For the syntax of this
  5084. option, check the "Color" section in the ffmpeg-utils manual.
  5085. The default value of @var{boxcolor} is "white".
  5086. @item borderw
  5087. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5088. The default value of @var{borderw} is 0.
  5089. @item bordercolor
  5090. Set the color to be used for drawing border around text. For the syntax of this
  5091. option, check the "Color" section in the ffmpeg-utils manual.
  5092. The default value of @var{bordercolor} is "black".
  5093. @item expansion
  5094. Select how the @var{text} is expanded. Can be either @code{none},
  5095. @code{strftime} (deprecated) or
  5096. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5097. below for details.
  5098. @item fix_bounds
  5099. If true, check and fix text coords to avoid clipping.
  5100. @item fontcolor
  5101. The color to be used for drawing fonts. For the syntax of this option, check
  5102. the "Color" section in the ffmpeg-utils manual.
  5103. The default value of @var{fontcolor} is "black".
  5104. @item fontcolor_expr
  5105. String which is expanded the same way as @var{text} to obtain dynamic
  5106. @var{fontcolor} value. By default this option has empty value and is not
  5107. processed. When this option is set, it overrides @var{fontcolor} option.
  5108. @item font
  5109. The font family to be used for drawing text. By default Sans.
  5110. @item fontfile
  5111. The font file to be used for drawing text. The path must be included.
  5112. This parameter is mandatory if the fontconfig support is disabled.
  5113. @item draw
  5114. This option does not exist, please see the timeline system
  5115. @item alpha
  5116. Draw the text applying alpha blending. The value can
  5117. be a number between 0.0 and 1.0.
  5118. The expression accepts the same variables @var{x, y} as well.
  5119. The default value is 1.
  5120. Please see @var{fontcolor_expr}.
  5121. @item fontsize
  5122. The font size to be used for drawing text.
  5123. The default value of @var{fontsize} is 16.
  5124. @item text_shaping
  5125. If set to 1, attempt to shape the text (for example, reverse the order of
  5126. right-to-left text and join Arabic characters) before drawing it.
  5127. Otherwise, just draw the text exactly as given.
  5128. By default 1 (if supported).
  5129. @item ft_load_flags
  5130. The flags to be used for loading the fonts.
  5131. The flags map the corresponding flags supported by libfreetype, and are
  5132. a combination of the following values:
  5133. @table @var
  5134. @item default
  5135. @item no_scale
  5136. @item no_hinting
  5137. @item render
  5138. @item no_bitmap
  5139. @item vertical_layout
  5140. @item force_autohint
  5141. @item crop_bitmap
  5142. @item pedantic
  5143. @item ignore_global_advance_width
  5144. @item no_recurse
  5145. @item ignore_transform
  5146. @item monochrome
  5147. @item linear_design
  5148. @item no_autohint
  5149. @end table
  5150. Default value is "default".
  5151. For more information consult the documentation for the FT_LOAD_*
  5152. libfreetype flags.
  5153. @item shadowcolor
  5154. The color to be used for drawing a shadow behind the drawn text. For the
  5155. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5156. The default value of @var{shadowcolor} is "black".
  5157. @item shadowx
  5158. @item shadowy
  5159. The x and y offsets for the text shadow position with respect to the
  5160. position of the text. They can be either positive or negative
  5161. values. The default value for both is "0".
  5162. @item start_number
  5163. The starting frame number for the n/frame_num variable. The default value
  5164. is "0".
  5165. @item tabsize
  5166. The size in number of spaces to use for rendering the tab.
  5167. Default value is 4.
  5168. @item timecode
  5169. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5170. format. It can be used with or without text parameter. @var{timecode_rate}
  5171. option must be specified.
  5172. @item timecode_rate, rate, r
  5173. Set the timecode frame rate (timecode only).
  5174. @item text
  5175. The text string to be drawn. The text must be a sequence of UTF-8
  5176. encoded characters.
  5177. This parameter is mandatory if no file is specified with the parameter
  5178. @var{textfile}.
  5179. @item textfile
  5180. A text file containing text to be drawn. The text must be a sequence
  5181. of UTF-8 encoded characters.
  5182. This parameter is mandatory if no text string is specified with the
  5183. parameter @var{text}.
  5184. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5185. @item reload
  5186. If set to 1, the @var{textfile} will be reloaded before each frame.
  5187. Be sure to update it atomically, or it may be read partially, or even fail.
  5188. @item x
  5189. @item y
  5190. The expressions which specify the offsets where text will be drawn
  5191. within the video frame. They are relative to the top/left border of the
  5192. output image.
  5193. The default value of @var{x} and @var{y} is "0".
  5194. See below for the list of accepted constants and functions.
  5195. @end table
  5196. The parameters for @var{x} and @var{y} are expressions containing the
  5197. following constants and functions:
  5198. @table @option
  5199. @item dar
  5200. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5201. @item hsub
  5202. @item vsub
  5203. horizontal and vertical chroma subsample values. For example for the
  5204. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5205. @item line_h, lh
  5206. the height of each text line
  5207. @item main_h, h, H
  5208. the input height
  5209. @item main_w, w, W
  5210. the input width
  5211. @item max_glyph_a, ascent
  5212. the maximum distance from the baseline to the highest/upper grid
  5213. coordinate used to place a glyph outline point, for all the rendered
  5214. glyphs.
  5215. It is a positive value, due to the grid's orientation with the Y axis
  5216. upwards.
  5217. @item max_glyph_d, descent
  5218. the maximum distance from the baseline to the lowest grid coordinate
  5219. used to place a glyph outline point, for all the rendered glyphs.
  5220. This is a negative value, due to the grid's orientation, with the Y axis
  5221. upwards.
  5222. @item max_glyph_h
  5223. maximum glyph height, that is the maximum height for all the glyphs
  5224. contained in the rendered text, it is equivalent to @var{ascent} -
  5225. @var{descent}.
  5226. @item max_glyph_w
  5227. maximum glyph width, that is the maximum width for all the glyphs
  5228. contained in the rendered text
  5229. @item n
  5230. the number of input frame, starting from 0
  5231. @item rand(min, max)
  5232. return a random number included between @var{min} and @var{max}
  5233. @item sar
  5234. The input sample aspect ratio.
  5235. @item t
  5236. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5237. @item text_h, th
  5238. the height of the rendered text
  5239. @item text_w, tw
  5240. the width of the rendered text
  5241. @item x
  5242. @item y
  5243. the x and y offset coordinates where the text is drawn.
  5244. These parameters allow the @var{x} and @var{y} expressions to refer
  5245. each other, so you can for example specify @code{y=x/dar}.
  5246. @end table
  5247. @anchor{drawtext_expansion}
  5248. @subsection Text expansion
  5249. If @option{expansion} is set to @code{strftime},
  5250. the filter recognizes strftime() sequences in the provided text and
  5251. expands them accordingly. Check the documentation of strftime(). This
  5252. feature is deprecated.
  5253. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5254. If @option{expansion} is set to @code{normal} (which is the default),
  5255. the following expansion mechanism is used.
  5256. The backslash character @samp{\}, followed by any character, always expands to
  5257. the second character.
  5258. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5259. braces is a function name, possibly followed by arguments separated by ':'.
  5260. If the arguments contain special characters or delimiters (':' or '@}'),
  5261. they should be escaped.
  5262. Note that they probably must also be escaped as the value for the
  5263. @option{text} option in the filter argument string and as the filter
  5264. argument in the filtergraph description, and possibly also for the shell,
  5265. that makes up to four levels of escaping; using a text file avoids these
  5266. problems.
  5267. The following functions are available:
  5268. @table @command
  5269. @item expr, e
  5270. The expression evaluation result.
  5271. It must take one argument specifying the expression to be evaluated,
  5272. which accepts the same constants and functions as the @var{x} and
  5273. @var{y} values. Note that not all constants should be used, for
  5274. example the text size is not known when evaluating the expression, so
  5275. the constants @var{text_w} and @var{text_h} will have an undefined
  5276. value.
  5277. @item expr_int_format, eif
  5278. Evaluate the expression's value and output as formatted integer.
  5279. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5280. The second argument specifies the output format. Allowed values are @samp{x},
  5281. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5282. @code{printf} function.
  5283. The third parameter is optional and sets the number of positions taken by the output.
  5284. It can be used to add padding with zeros from the left.
  5285. @item gmtime
  5286. The time at which the filter is running, expressed in UTC.
  5287. It can accept an argument: a strftime() format string.
  5288. @item localtime
  5289. The time at which the filter is running, expressed in the local time zone.
  5290. It can accept an argument: a strftime() format string.
  5291. @item metadata
  5292. Frame metadata. Takes one or two arguments.
  5293. The first argument is mandatory and specifies the metadata key.
  5294. The second argument is optional and specifies a default value, used when the
  5295. metadata key is not found or empty.
  5296. @item n, frame_num
  5297. The frame number, starting from 0.
  5298. @item pict_type
  5299. A 1 character description of the current picture type.
  5300. @item pts
  5301. The timestamp of the current frame.
  5302. It can take up to three arguments.
  5303. The first argument is the format of the timestamp; it defaults to @code{flt}
  5304. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5305. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5306. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5307. @code{localtime} stands for the timestamp of the frame formatted as
  5308. local time zone time.
  5309. The second argument is an offset added to the timestamp.
  5310. If the format is set to @code{localtime} or @code{gmtime},
  5311. a third argument may be supplied: a strftime() format string.
  5312. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5313. @end table
  5314. @subsection Examples
  5315. @itemize
  5316. @item
  5317. Draw "Test Text" with font FreeSerif, using the default values for the
  5318. optional parameters.
  5319. @example
  5320. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5321. @end example
  5322. @item
  5323. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5324. and y=50 (counting from the top-left corner of the screen), text is
  5325. yellow with a red box around it. Both the text and the box have an
  5326. opacity of 20%.
  5327. @example
  5328. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5329. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5330. @end example
  5331. Note that the double quotes are not necessary if spaces are not used
  5332. within the parameter list.
  5333. @item
  5334. Show the text at the center of the video frame:
  5335. @example
  5336. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5337. @end example
  5338. @item
  5339. Show the text at a random position, switching to a new position every 30 seconds:
  5340. @example
  5341. 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)"
  5342. @end example
  5343. @item
  5344. Show a text line sliding from right to left in the last row of the video
  5345. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5346. with no newlines.
  5347. @example
  5348. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5349. @end example
  5350. @item
  5351. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5352. @example
  5353. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5354. @end example
  5355. @item
  5356. Draw a single green letter "g", at the center of the input video.
  5357. The glyph baseline is placed at half screen height.
  5358. @example
  5359. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5360. @end example
  5361. @item
  5362. Show text for 1 second every 3 seconds:
  5363. @example
  5364. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5365. @end example
  5366. @item
  5367. Use fontconfig to set the font. Note that the colons need to be escaped.
  5368. @example
  5369. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5370. @end example
  5371. @item
  5372. Print the date of a real-time encoding (see strftime(3)):
  5373. @example
  5374. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5375. @end example
  5376. @item
  5377. Show text fading in and out (appearing/disappearing):
  5378. @example
  5379. #!/bin/sh
  5380. DS=1.0 # display start
  5381. DE=10.0 # display end
  5382. FID=1.5 # fade in duration
  5383. FOD=5 # fade out duration
  5384. 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 @}"
  5385. @end example
  5386. @end itemize
  5387. For more information about libfreetype, check:
  5388. @url{http://www.freetype.org/}.
  5389. For more information about fontconfig, check:
  5390. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5391. For more information about libfribidi, check:
  5392. @url{http://fribidi.org/}.
  5393. @section edgedetect
  5394. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5395. The filter accepts the following options:
  5396. @table @option
  5397. @item low
  5398. @item high
  5399. Set low and high threshold values used by the Canny thresholding
  5400. algorithm.
  5401. The high threshold selects the "strong" edge pixels, which are then
  5402. connected through 8-connectivity with the "weak" edge pixels selected
  5403. by the low threshold.
  5404. @var{low} and @var{high} threshold values must be chosen in the range
  5405. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5406. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5407. is @code{50/255}.
  5408. @item mode
  5409. Define the drawing mode.
  5410. @table @samp
  5411. @item wires
  5412. Draw white/gray wires on black background.
  5413. @item colormix
  5414. Mix the colors to create a paint/cartoon effect.
  5415. @end table
  5416. Default value is @var{wires}.
  5417. @end table
  5418. @subsection Examples
  5419. @itemize
  5420. @item
  5421. Standard edge detection with custom values for the hysteresis thresholding:
  5422. @example
  5423. edgedetect=low=0.1:high=0.4
  5424. @end example
  5425. @item
  5426. Painting effect without thresholding:
  5427. @example
  5428. edgedetect=mode=colormix:high=0
  5429. @end example
  5430. @end itemize
  5431. @section eq
  5432. Set brightness, contrast, saturation and approximate gamma adjustment.
  5433. The filter accepts the following options:
  5434. @table @option
  5435. @item contrast
  5436. Set the contrast expression. The value must be a float value in range
  5437. @code{-2.0} to @code{2.0}. The default value is "1".
  5438. @item brightness
  5439. Set the brightness expression. The value must be a float value in
  5440. range @code{-1.0} to @code{1.0}. The default value is "0".
  5441. @item saturation
  5442. Set the saturation expression. The value must be a float in
  5443. range @code{0.0} to @code{3.0}. The default value is "1".
  5444. @item gamma
  5445. Set the gamma expression. The value must be a float in range
  5446. @code{0.1} to @code{10.0}. The default value is "1".
  5447. @item gamma_r
  5448. Set the gamma expression for red. The value must be a float in
  5449. range @code{0.1} to @code{10.0}. The default value is "1".
  5450. @item gamma_g
  5451. Set the gamma expression for green. The value must be a float in range
  5452. @code{0.1} to @code{10.0}. The default value is "1".
  5453. @item gamma_b
  5454. Set the gamma expression for blue. The value must be a float in range
  5455. @code{0.1} to @code{10.0}. The default value is "1".
  5456. @item gamma_weight
  5457. Set the gamma weight expression. It can be used to reduce the effect
  5458. of a high gamma value on bright image areas, e.g. keep them from
  5459. getting overamplified and just plain white. The value must be a float
  5460. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5461. gamma correction all the way down while @code{1.0} leaves it at its
  5462. full strength. Default is "1".
  5463. @item eval
  5464. Set when the expressions for brightness, contrast, saturation and
  5465. gamma expressions are evaluated.
  5466. It accepts the following values:
  5467. @table @samp
  5468. @item init
  5469. only evaluate expressions once during the filter initialization or
  5470. when a command is processed
  5471. @item frame
  5472. evaluate expressions for each incoming frame
  5473. @end table
  5474. Default value is @samp{init}.
  5475. @end table
  5476. The expressions accept the following parameters:
  5477. @table @option
  5478. @item n
  5479. frame count of the input frame starting from 0
  5480. @item pos
  5481. byte position of the corresponding packet in the input file, NAN if
  5482. unspecified
  5483. @item r
  5484. frame rate of the input video, NAN if the input frame rate is unknown
  5485. @item t
  5486. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5487. @end table
  5488. @subsection Commands
  5489. The filter supports the following commands:
  5490. @table @option
  5491. @item contrast
  5492. Set the contrast expression.
  5493. @item brightness
  5494. Set the brightness expression.
  5495. @item saturation
  5496. Set the saturation expression.
  5497. @item gamma
  5498. Set the gamma expression.
  5499. @item gamma_r
  5500. Set the gamma_r expression.
  5501. @item gamma_g
  5502. Set gamma_g expression.
  5503. @item gamma_b
  5504. Set gamma_b expression.
  5505. @item gamma_weight
  5506. Set gamma_weight expression.
  5507. The command accepts the same syntax of the corresponding option.
  5508. If the specified expression is not valid, it is kept at its current
  5509. value.
  5510. @end table
  5511. @section erosion
  5512. Apply erosion effect to the video.
  5513. This filter replaces the pixel by the local(3x3) minimum.
  5514. It accepts the following options:
  5515. @table @option
  5516. @item threshold0
  5517. @item threshold1
  5518. @item threshold2
  5519. @item threshold3
  5520. Limit the maximum change for each plane, default is 65535.
  5521. If 0, plane will remain unchanged.
  5522. @item coordinates
  5523. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5524. pixels are used.
  5525. Flags to local 3x3 coordinates maps like this:
  5526. 1 2 3
  5527. 4 5
  5528. 6 7 8
  5529. @end table
  5530. @section extractplanes
  5531. Extract color channel components from input video stream into
  5532. separate grayscale video streams.
  5533. The filter accepts the following option:
  5534. @table @option
  5535. @item planes
  5536. Set plane(s) to extract.
  5537. Available values for planes are:
  5538. @table @samp
  5539. @item y
  5540. @item u
  5541. @item v
  5542. @item a
  5543. @item r
  5544. @item g
  5545. @item b
  5546. @end table
  5547. Choosing planes not available in the input will result in an error.
  5548. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5549. with @code{y}, @code{u}, @code{v} planes at same time.
  5550. @end table
  5551. @subsection Examples
  5552. @itemize
  5553. @item
  5554. Extract luma, u and v color channel component from input video frame
  5555. into 3 grayscale outputs:
  5556. @example
  5557. 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
  5558. @end example
  5559. @end itemize
  5560. @section elbg
  5561. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5562. For each input image, the filter will compute the optimal mapping from
  5563. the input to the output given the codebook length, that is the number
  5564. of distinct output colors.
  5565. This filter accepts the following options.
  5566. @table @option
  5567. @item codebook_length, l
  5568. Set codebook length. The value must be a positive integer, and
  5569. represents the number of distinct output colors. Default value is 256.
  5570. @item nb_steps, n
  5571. Set the maximum number of iterations to apply for computing the optimal
  5572. mapping. The higher the value the better the result and the higher the
  5573. computation time. Default value is 1.
  5574. @item seed, s
  5575. Set a random seed, must be an integer included between 0 and
  5576. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5577. will try to use a good random seed on a best effort basis.
  5578. @item pal8
  5579. Set pal8 output pixel format. This option does not work with codebook
  5580. length greater than 256.
  5581. @end table
  5582. @section fade
  5583. Apply a fade-in/out effect to the input video.
  5584. It accepts the following parameters:
  5585. @table @option
  5586. @item type, t
  5587. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5588. effect.
  5589. Default is @code{in}.
  5590. @item start_frame, s
  5591. Specify the number of the frame to start applying the fade
  5592. effect at. Default is 0.
  5593. @item nb_frames, n
  5594. The number of frames that the fade effect lasts. At the end of the
  5595. fade-in effect, the output video will have the same intensity as the input video.
  5596. At the end of the fade-out transition, the output video will be filled with the
  5597. selected @option{color}.
  5598. Default is 25.
  5599. @item alpha
  5600. If set to 1, fade only alpha channel, if one exists on the input.
  5601. Default value is 0.
  5602. @item start_time, st
  5603. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5604. effect. If both start_frame and start_time are specified, the fade will start at
  5605. whichever comes last. Default is 0.
  5606. @item duration, d
  5607. The number of seconds for which the fade effect has to last. At the end of the
  5608. fade-in effect the output video will have the same intensity as the input video,
  5609. at the end of the fade-out transition the output video will be filled with the
  5610. selected @option{color}.
  5611. If both duration and nb_frames are specified, duration is used. Default is 0
  5612. (nb_frames is used by default).
  5613. @item color, c
  5614. Specify the color of the fade. Default is "black".
  5615. @end table
  5616. @subsection Examples
  5617. @itemize
  5618. @item
  5619. Fade in the first 30 frames of video:
  5620. @example
  5621. fade=in:0:30
  5622. @end example
  5623. The command above is equivalent to:
  5624. @example
  5625. fade=t=in:s=0:n=30
  5626. @end example
  5627. @item
  5628. Fade out the last 45 frames of a 200-frame video:
  5629. @example
  5630. fade=out:155:45
  5631. fade=type=out:start_frame=155:nb_frames=45
  5632. @end example
  5633. @item
  5634. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5635. @example
  5636. fade=in:0:25, fade=out:975:25
  5637. @end example
  5638. @item
  5639. Make the first 5 frames yellow, then fade in from frame 5-24:
  5640. @example
  5641. fade=in:5:20:color=yellow
  5642. @end example
  5643. @item
  5644. Fade in alpha over first 25 frames of video:
  5645. @example
  5646. fade=in:0:25:alpha=1
  5647. @end example
  5648. @item
  5649. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5650. @example
  5651. fade=t=in:st=5.5:d=0.5
  5652. @end example
  5653. @end itemize
  5654. @section fftfilt
  5655. Apply arbitrary expressions to samples in frequency domain
  5656. @table @option
  5657. @item dc_Y
  5658. Adjust the dc value (gain) of the luma plane of the image. The filter
  5659. accepts an integer value in range @code{0} to @code{1000}. The default
  5660. value is set to @code{0}.
  5661. @item dc_U
  5662. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5663. filter accepts an integer value in range @code{0} to @code{1000}. The
  5664. default value is set to @code{0}.
  5665. @item dc_V
  5666. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5667. filter accepts an integer value in range @code{0} to @code{1000}. The
  5668. default value is set to @code{0}.
  5669. @item weight_Y
  5670. Set the frequency domain weight expression for the luma plane.
  5671. @item weight_U
  5672. Set the frequency domain weight expression for the 1st chroma plane.
  5673. @item weight_V
  5674. Set the frequency domain weight expression for the 2nd chroma plane.
  5675. The filter accepts the following variables:
  5676. @item X
  5677. @item Y
  5678. The coordinates of the current sample.
  5679. @item W
  5680. @item H
  5681. The width and height of the image.
  5682. @end table
  5683. @subsection Examples
  5684. @itemize
  5685. @item
  5686. High-pass:
  5687. @example
  5688. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5689. @end example
  5690. @item
  5691. Low-pass:
  5692. @example
  5693. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5694. @end example
  5695. @item
  5696. Sharpen:
  5697. @example
  5698. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5699. @end example
  5700. @item
  5701. Blur:
  5702. @example
  5703. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5704. @end example
  5705. @end itemize
  5706. @section field
  5707. Extract a single field from an interlaced image using stride
  5708. arithmetic to avoid wasting CPU time. The output frames are marked as
  5709. non-interlaced.
  5710. The filter accepts the following options:
  5711. @table @option
  5712. @item type
  5713. Specify whether to extract the top (if the value is @code{0} or
  5714. @code{top}) or the bottom field (if the value is @code{1} or
  5715. @code{bottom}).
  5716. @end table
  5717. @section fieldhint
  5718. Create new frames by copying the top and bottom fields from surrounding frames
  5719. supplied as numbers by the hint file.
  5720. @table @option
  5721. @item hint
  5722. Set file containing hints: absolute/relative frame numbers.
  5723. There must be one line for each frame in a clip. Each line must contain two
  5724. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5725. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5726. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5727. for @code{relative} mode. First number tells from which frame to pick up top
  5728. field and second number tells from which frame to pick up bottom field.
  5729. If optionally followed by @code{+} output frame will be marked as interlaced,
  5730. else if followed by @code{-} output frame will be marked as progressive, else
  5731. it will be marked same as input frame.
  5732. If line starts with @code{#} or @code{;} that line is skipped.
  5733. @item mode
  5734. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5735. @end table
  5736. Example of first several lines of @code{hint} file for @code{relative} mode:
  5737. @example
  5738. 0,0 - # first frame
  5739. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5740. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5741. 1,0 -
  5742. 0,0 -
  5743. 0,0 -
  5744. 1,0 -
  5745. 1,0 -
  5746. 1,0 -
  5747. 0,0 -
  5748. 0,0 -
  5749. 1,0 -
  5750. 1,0 -
  5751. 1,0 -
  5752. 0,0 -
  5753. @end example
  5754. @section fieldmatch
  5755. Field matching filter for inverse telecine. It is meant to reconstruct the
  5756. progressive frames from a telecined stream. The filter does not drop duplicated
  5757. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5758. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5759. The separation of the field matching and the decimation is notably motivated by
  5760. the possibility of inserting a de-interlacing filter fallback between the two.
  5761. If the source has mixed telecined and real interlaced content,
  5762. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5763. But these remaining combed frames will be marked as interlaced, and thus can be
  5764. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5765. In addition to the various configuration options, @code{fieldmatch} can take an
  5766. optional second stream, activated through the @option{ppsrc} option. If
  5767. enabled, the frames reconstruction will be based on the fields and frames from
  5768. this second stream. This allows the first input to be pre-processed in order to
  5769. help the various algorithms of the filter, while keeping the output lossless
  5770. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5771. or brightness/contrast adjustments can help.
  5772. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5773. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5774. which @code{fieldmatch} is based on. While the semantic and usage are very
  5775. close, some behaviour and options names can differ.
  5776. The @ref{decimate} filter currently only works for constant frame rate input.
  5777. If your input has mixed telecined (30fps) and progressive content with a lower
  5778. framerate like 24fps use the following filterchain to produce the necessary cfr
  5779. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5780. The filter accepts the following options:
  5781. @table @option
  5782. @item order
  5783. Specify the assumed field order of the input stream. Available values are:
  5784. @table @samp
  5785. @item auto
  5786. Auto detect parity (use FFmpeg's internal parity value).
  5787. @item bff
  5788. Assume bottom field first.
  5789. @item tff
  5790. Assume top field first.
  5791. @end table
  5792. Note that it is sometimes recommended not to trust the parity announced by the
  5793. stream.
  5794. Default value is @var{auto}.
  5795. @item mode
  5796. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5797. sense that it won't risk creating jerkiness due to duplicate frames when
  5798. possible, but if there are bad edits or blended fields it will end up
  5799. outputting combed frames when a good match might actually exist. On the other
  5800. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5801. but will almost always find a good frame if there is one. The other values are
  5802. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5803. jerkiness and creating duplicate frames versus finding good matches in sections
  5804. with bad edits, orphaned fields, blended fields, etc.
  5805. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5806. Available values are:
  5807. @table @samp
  5808. @item pc
  5809. 2-way matching (p/c)
  5810. @item pc_n
  5811. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5812. @item pc_u
  5813. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5814. @item pc_n_ub
  5815. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5816. still combed (p/c + n + u/b)
  5817. @item pcn
  5818. 3-way matching (p/c/n)
  5819. @item pcn_ub
  5820. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5821. detected as combed (p/c/n + u/b)
  5822. @end table
  5823. The parenthesis at the end indicate the matches that would be used for that
  5824. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5825. @var{top}).
  5826. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5827. the slowest.
  5828. Default value is @var{pc_n}.
  5829. @item ppsrc
  5830. Mark the main input stream as a pre-processed input, and enable the secondary
  5831. input stream as the clean source to pick the fields from. See the filter
  5832. introduction for more details. It is similar to the @option{clip2} feature from
  5833. VFM/TFM.
  5834. Default value is @code{0} (disabled).
  5835. @item field
  5836. Set the field to match from. It is recommended to set this to the same value as
  5837. @option{order} unless you experience matching failures with that setting. In
  5838. certain circumstances changing the field that is used to match from can have a
  5839. large impact on matching performance. Available values are:
  5840. @table @samp
  5841. @item auto
  5842. Automatic (same value as @option{order}).
  5843. @item bottom
  5844. Match from the bottom field.
  5845. @item top
  5846. Match from the top field.
  5847. @end table
  5848. Default value is @var{auto}.
  5849. @item mchroma
  5850. Set whether or not chroma is included during the match comparisons. In most
  5851. cases it is recommended to leave this enabled. You should set this to @code{0}
  5852. only if your clip has bad chroma problems such as heavy rainbowing or other
  5853. artifacts. Setting this to @code{0} could also be used to speed things up at
  5854. the cost of some accuracy.
  5855. Default value is @code{1}.
  5856. @item y0
  5857. @item y1
  5858. These define an exclusion band which excludes the lines between @option{y0} and
  5859. @option{y1} from being included in the field matching decision. An exclusion
  5860. band can be used to ignore subtitles, a logo, or other things that may
  5861. interfere with the matching. @option{y0} sets the starting scan line and
  5862. @option{y1} sets the ending line; all lines in between @option{y0} and
  5863. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5864. @option{y0} and @option{y1} to the same value will disable the feature.
  5865. @option{y0} and @option{y1} defaults to @code{0}.
  5866. @item scthresh
  5867. Set the scene change detection threshold as a percentage of maximum change on
  5868. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5869. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5870. @option{scthresh} is @code{[0.0, 100.0]}.
  5871. Default value is @code{12.0}.
  5872. @item combmatch
  5873. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5874. account the combed scores of matches when deciding what match to use as the
  5875. final match. Available values are:
  5876. @table @samp
  5877. @item none
  5878. No final matching based on combed scores.
  5879. @item sc
  5880. Combed scores are only used when a scene change is detected.
  5881. @item full
  5882. Use combed scores all the time.
  5883. @end table
  5884. Default is @var{sc}.
  5885. @item combdbg
  5886. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5887. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5888. Available values are:
  5889. @table @samp
  5890. @item none
  5891. No forced calculation.
  5892. @item pcn
  5893. Force p/c/n calculations.
  5894. @item pcnub
  5895. Force p/c/n/u/b calculations.
  5896. @end table
  5897. Default value is @var{none}.
  5898. @item cthresh
  5899. This is the area combing threshold used for combed frame detection. This
  5900. essentially controls how "strong" or "visible" combing must be to be detected.
  5901. Larger values mean combing must be more visible and smaller values mean combing
  5902. can be less visible or strong and still be detected. Valid settings are from
  5903. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5904. be detected as combed). This is basically a pixel difference value. A good
  5905. range is @code{[8, 12]}.
  5906. Default value is @code{9}.
  5907. @item chroma
  5908. Sets whether or not chroma is considered in the combed frame decision. Only
  5909. disable this if your source has chroma problems (rainbowing, etc.) that are
  5910. causing problems for the combed frame detection with chroma enabled. Actually,
  5911. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5912. where there is chroma only combing in the source.
  5913. Default value is @code{0}.
  5914. @item blockx
  5915. @item blocky
  5916. Respectively set the x-axis and y-axis size of the window used during combed
  5917. frame detection. This has to do with the size of the area in which
  5918. @option{combpel} pixels are required to be detected as combed for a frame to be
  5919. declared combed. See the @option{combpel} parameter description for more info.
  5920. Possible values are any number that is a power of 2 starting at 4 and going up
  5921. to 512.
  5922. Default value is @code{16}.
  5923. @item combpel
  5924. The number of combed pixels inside any of the @option{blocky} by
  5925. @option{blockx} size blocks on the frame for the frame to be detected as
  5926. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5927. setting controls "how much" combing there must be in any localized area (a
  5928. window defined by the @option{blockx} and @option{blocky} settings) on the
  5929. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5930. which point no frames will ever be detected as combed). This setting is known
  5931. as @option{MI} in TFM/VFM vocabulary.
  5932. Default value is @code{80}.
  5933. @end table
  5934. @anchor{p/c/n/u/b meaning}
  5935. @subsection p/c/n/u/b meaning
  5936. @subsubsection p/c/n
  5937. We assume the following telecined stream:
  5938. @example
  5939. Top fields: 1 2 2 3 4
  5940. Bottom fields: 1 2 3 4 4
  5941. @end example
  5942. The numbers correspond to the progressive frame the fields relate to. Here, the
  5943. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5944. When @code{fieldmatch} is configured to run a matching from bottom
  5945. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5946. @example
  5947. Input stream:
  5948. T 1 2 2 3 4
  5949. B 1 2 3 4 4 <-- matching reference
  5950. Matches: c c n n c
  5951. Output stream:
  5952. T 1 2 3 4 4
  5953. B 1 2 3 4 4
  5954. @end example
  5955. As a result of the field matching, we can see that some frames get duplicated.
  5956. To perform a complete inverse telecine, you need to rely on a decimation filter
  5957. after this operation. See for instance the @ref{decimate} filter.
  5958. The same operation now matching from top fields (@option{field}=@var{top})
  5959. looks like this:
  5960. @example
  5961. Input stream:
  5962. T 1 2 2 3 4 <-- matching reference
  5963. B 1 2 3 4 4
  5964. Matches: c c p p c
  5965. Output stream:
  5966. T 1 2 2 3 4
  5967. B 1 2 2 3 4
  5968. @end example
  5969. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5970. basically, they refer to the frame and field of the opposite parity:
  5971. @itemize
  5972. @item @var{p} matches the field of the opposite parity in the previous frame
  5973. @item @var{c} matches the field of the opposite parity in the current frame
  5974. @item @var{n} matches the field of the opposite parity in the next frame
  5975. @end itemize
  5976. @subsubsection u/b
  5977. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5978. from the opposite parity flag. In the following examples, we assume that we are
  5979. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5980. 'x' is placed above and below each matched fields.
  5981. With bottom matching (@option{field}=@var{bottom}):
  5982. @example
  5983. Match: c p n b u
  5984. x x x x x
  5985. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5986. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5987. x x x x x
  5988. Output frames:
  5989. 2 1 2 2 2
  5990. 2 2 2 1 3
  5991. @end example
  5992. With top matching (@option{field}=@var{top}):
  5993. @example
  5994. Match: c p n b u
  5995. x x x x x
  5996. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5997. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5998. x x x x x
  5999. Output frames:
  6000. 2 2 2 1 2
  6001. 2 1 3 2 2
  6002. @end example
  6003. @subsection Examples
  6004. Simple IVTC of a top field first telecined stream:
  6005. @example
  6006. fieldmatch=order=tff:combmatch=none, decimate
  6007. @end example
  6008. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6009. @example
  6010. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6011. @end example
  6012. @section fieldorder
  6013. Transform the field order of the input video.
  6014. It accepts the following parameters:
  6015. @table @option
  6016. @item order
  6017. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6018. for bottom field first.
  6019. @end table
  6020. The default value is @samp{tff}.
  6021. The transformation is done by shifting the picture content up or down
  6022. by one line, and filling the remaining line with appropriate picture content.
  6023. This method is consistent with most broadcast field order converters.
  6024. If the input video is not flagged as being interlaced, or it is already
  6025. flagged as being of the required output field order, then this filter does
  6026. not alter the incoming video.
  6027. It is very useful when converting to or from PAL DV material,
  6028. which is bottom field first.
  6029. For example:
  6030. @example
  6031. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6032. @end example
  6033. @section fifo, afifo
  6034. Buffer input images and send them when they are requested.
  6035. It is mainly useful when auto-inserted by the libavfilter
  6036. framework.
  6037. It does not take parameters.
  6038. @section find_rect
  6039. Find a rectangular object
  6040. It accepts the following options:
  6041. @table @option
  6042. @item object
  6043. Filepath of the object image, needs to be in gray8.
  6044. @item threshold
  6045. Detection threshold, default is 0.5.
  6046. @item mipmaps
  6047. Number of mipmaps, default is 3.
  6048. @item xmin, ymin, xmax, ymax
  6049. Specifies the rectangle in which to search.
  6050. @end table
  6051. @subsection Examples
  6052. @itemize
  6053. @item
  6054. Generate a representative palette of a given video using @command{ffmpeg}:
  6055. @example
  6056. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6057. @end example
  6058. @end itemize
  6059. @section cover_rect
  6060. Cover a rectangular object
  6061. It accepts the following options:
  6062. @table @option
  6063. @item cover
  6064. Filepath of the optional cover image, needs to be in yuv420.
  6065. @item mode
  6066. Set covering mode.
  6067. It accepts the following values:
  6068. @table @samp
  6069. @item cover
  6070. cover it by the supplied image
  6071. @item blur
  6072. cover it by interpolating the surrounding pixels
  6073. @end table
  6074. Default value is @var{blur}.
  6075. @end table
  6076. @subsection Examples
  6077. @itemize
  6078. @item
  6079. Generate a representative palette of a given video using @command{ffmpeg}:
  6080. @example
  6081. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6082. @end example
  6083. @end itemize
  6084. @anchor{format}
  6085. @section format
  6086. Convert the input video to one of the specified pixel formats.
  6087. Libavfilter will try to pick one that is suitable as input to
  6088. the next filter.
  6089. It accepts the following parameters:
  6090. @table @option
  6091. @item pix_fmts
  6092. A '|'-separated list of pixel format names, such as
  6093. "pix_fmts=yuv420p|monow|rgb24".
  6094. @end table
  6095. @subsection Examples
  6096. @itemize
  6097. @item
  6098. Convert the input video to the @var{yuv420p} format
  6099. @example
  6100. format=pix_fmts=yuv420p
  6101. @end example
  6102. Convert the input video to any of the formats in the list
  6103. @example
  6104. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6105. @end example
  6106. @end itemize
  6107. @anchor{fps}
  6108. @section fps
  6109. Convert the video to specified constant frame rate by duplicating or dropping
  6110. frames as necessary.
  6111. It accepts the following parameters:
  6112. @table @option
  6113. @item fps
  6114. The desired output frame rate. The default is @code{25}.
  6115. @item round
  6116. Rounding method.
  6117. Possible values are:
  6118. @table @option
  6119. @item zero
  6120. zero round towards 0
  6121. @item inf
  6122. round away from 0
  6123. @item down
  6124. round towards -infinity
  6125. @item up
  6126. round towards +infinity
  6127. @item near
  6128. round to nearest
  6129. @end table
  6130. The default is @code{near}.
  6131. @item start_time
  6132. Assume the first PTS should be the given value, in seconds. This allows for
  6133. padding/trimming at the start of stream. By default, no assumption is made
  6134. about the first frame's expected PTS, so no padding or trimming is done.
  6135. For example, this could be set to 0 to pad the beginning with duplicates of
  6136. the first frame if a video stream starts after the audio stream or to trim any
  6137. frames with a negative PTS.
  6138. @end table
  6139. Alternatively, the options can be specified as a flat string:
  6140. @var{fps}[:@var{round}].
  6141. See also the @ref{setpts} filter.
  6142. @subsection Examples
  6143. @itemize
  6144. @item
  6145. A typical usage in order to set the fps to 25:
  6146. @example
  6147. fps=fps=25
  6148. @end example
  6149. @item
  6150. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6151. @example
  6152. fps=fps=film:round=near
  6153. @end example
  6154. @end itemize
  6155. @section framepack
  6156. Pack two different video streams into a stereoscopic video, setting proper
  6157. metadata on supported codecs. The two views should have the same size and
  6158. framerate and processing will stop when the shorter video ends. Please note
  6159. that you may conveniently adjust view properties with the @ref{scale} and
  6160. @ref{fps} filters.
  6161. It accepts the following parameters:
  6162. @table @option
  6163. @item format
  6164. The desired packing format. Supported values are:
  6165. @table @option
  6166. @item sbs
  6167. The views are next to each other (default).
  6168. @item tab
  6169. The views are on top of each other.
  6170. @item lines
  6171. The views are packed by line.
  6172. @item columns
  6173. The views are packed by column.
  6174. @item frameseq
  6175. The views are temporally interleaved.
  6176. @end table
  6177. @end table
  6178. Some examples:
  6179. @example
  6180. # Convert left and right views into a frame-sequential video
  6181. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6182. # Convert views into a side-by-side video with the same output resolution as the input
  6183. 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
  6184. @end example
  6185. @section framerate
  6186. Change the frame rate by interpolating new video output frames from the source
  6187. frames.
  6188. This filter is not designed to function correctly with interlaced media. If
  6189. you wish to change the frame rate of interlaced media then you are required
  6190. to deinterlace before this filter and re-interlace after this filter.
  6191. A description of the accepted options follows.
  6192. @table @option
  6193. @item fps
  6194. Specify the output frames per second. This option can also be specified
  6195. as a value alone. The default is @code{50}.
  6196. @item interp_start
  6197. Specify the start of a range where the output frame will be created as a
  6198. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6199. the default is @code{15}.
  6200. @item interp_end
  6201. Specify the end of a range where the output frame will be created as a
  6202. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6203. the default is @code{240}.
  6204. @item scene
  6205. Specify the level at which a scene change is detected as a value between
  6206. 0 and 100 to indicate a new scene; a low value reflects a low
  6207. probability for the current frame to introduce a new scene, while a higher
  6208. value means the current frame is more likely to be one.
  6209. The default is @code{7}.
  6210. @item flags
  6211. Specify flags influencing the filter process.
  6212. Available value for @var{flags} is:
  6213. @table @option
  6214. @item scene_change_detect, scd
  6215. Enable scene change detection using the value of the option @var{scene}.
  6216. This flag is enabled by default.
  6217. @end table
  6218. @end table
  6219. @section framestep
  6220. Select one frame every N-th frame.
  6221. This filter accepts the following option:
  6222. @table @option
  6223. @item step
  6224. Select frame after every @code{step} frames.
  6225. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6226. @end table
  6227. @anchor{frei0r}
  6228. @section frei0r
  6229. Apply a frei0r effect to the input video.
  6230. To enable the compilation of this filter, you need to install the frei0r
  6231. header and configure FFmpeg with @code{--enable-frei0r}.
  6232. It accepts the following parameters:
  6233. @table @option
  6234. @item filter_name
  6235. The name of the frei0r effect to load. If the environment variable
  6236. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6237. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6238. Otherwise, the standard frei0r paths are searched, in this order:
  6239. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6240. @file{/usr/lib/frei0r-1/}.
  6241. @item filter_params
  6242. A '|'-separated list of parameters to pass to the frei0r effect.
  6243. @end table
  6244. A frei0r effect parameter can be a boolean (its value is either
  6245. "y" or "n"), a double, a color (specified as
  6246. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6247. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6248. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6249. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6250. The number and types of parameters depend on the loaded effect. If an
  6251. effect parameter is not specified, the default value is set.
  6252. @subsection Examples
  6253. @itemize
  6254. @item
  6255. Apply the distort0r effect, setting the first two double parameters:
  6256. @example
  6257. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6258. @end example
  6259. @item
  6260. Apply the colordistance effect, taking a color as the first parameter:
  6261. @example
  6262. frei0r=colordistance:0.2/0.3/0.4
  6263. frei0r=colordistance:violet
  6264. frei0r=colordistance:0x112233
  6265. @end example
  6266. @item
  6267. Apply the perspective effect, specifying the top left and top right image
  6268. positions:
  6269. @example
  6270. frei0r=perspective:0.2/0.2|0.8/0.2
  6271. @end example
  6272. @end itemize
  6273. For more information, see
  6274. @url{http://frei0r.dyne.org}
  6275. @section fspp
  6276. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6277. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6278. processing filter, one of them is performed once per block, not per pixel.
  6279. This allows for much higher speed.
  6280. The filter accepts the following options:
  6281. @table @option
  6282. @item quality
  6283. Set quality. This option defines the number of levels for averaging. It accepts
  6284. an integer in the range 4-5. Default value is @code{4}.
  6285. @item qp
  6286. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6287. If not set, the filter will use the QP from the video stream (if available).
  6288. @item strength
  6289. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6290. more details but also more artifacts, while higher values make the image smoother
  6291. but also blurrier. Default value is @code{0} − PSNR optimal.
  6292. @item use_bframe_qp
  6293. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6294. option may cause flicker since the B-Frames have often larger QP. Default is
  6295. @code{0} (not enabled).
  6296. @end table
  6297. @section geq
  6298. The filter accepts the following options:
  6299. @table @option
  6300. @item lum_expr, lum
  6301. Set the luminance expression.
  6302. @item cb_expr, cb
  6303. Set the chrominance blue expression.
  6304. @item cr_expr, cr
  6305. Set the chrominance red expression.
  6306. @item alpha_expr, a
  6307. Set the alpha expression.
  6308. @item red_expr, r
  6309. Set the red expression.
  6310. @item green_expr, g
  6311. Set the green expression.
  6312. @item blue_expr, b
  6313. Set the blue expression.
  6314. @end table
  6315. The colorspace is selected according to the specified options. If one
  6316. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6317. options is specified, the filter will automatically select a YCbCr
  6318. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6319. @option{blue_expr} options is specified, it will select an RGB
  6320. colorspace.
  6321. If one of the chrominance expression is not defined, it falls back on the other
  6322. one. If no alpha expression is specified it will evaluate to opaque value.
  6323. If none of chrominance expressions are specified, they will evaluate
  6324. to the luminance expression.
  6325. The expressions can use the following variables and functions:
  6326. @table @option
  6327. @item N
  6328. The sequential number of the filtered frame, starting from @code{0}.
  6329. @item X
  6330. @item Y
  6331. The coordinates of the current sample.
  6332. @item W
  6333. @item H
  6334. The width and height of the image.
  6335. @item SW
  6336. @item SH
  6337. Width and height scale depending on the currently filtered plane. It is the
  6338. ratio between the corresponding luma plane number of pixels and the current
  6339. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6340. @code{0.5,0.5} for chroma planes.
  6341. @item T
  6342. Time of the current frame, expressed in seconds.
  6343. @item p(x, y)
  6344. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6345. plane.
  6346. @item lum(x, y)
  6347. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6348. plane.
  6349. @item cb(x, y)
  6350. Return the value of the pixel at location (@var{x},@var{y}) of the
  6351. blue-difference chroma plane. Return 0 if there is no such plane.
  6352. @item cr(x, y)
  6353. Return the value of the pixel at location (@var{x},@var{y}) of the
  6354. red-difference chroma plane. Return 0 if there is no such plane.
  6355. @item r(x, y)
  6356. @item g(x, y)
  6357. @item b(x, y)
  6358. Return the value of the pixel at location (@var{x},@var{y}) of the
  6359. red/green/blue component. Return 0 if there is no such component.
  6360. @item alpha(x, y)
  6361. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6362. plane. Return 0 if there is no such plane.
  6363. @end table
  6364. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6365. automatically clipped to the closer edge.
  6366. @subsection Examples
  6367. @itemize
  6368. @item
  6369. Flip the image horizontally:
  6370. @example
  6371. geq=p(W-X\,Y)
  6372. @end example
  6373. @item
  6374. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6375. wavelength of 100 pixels:
  6376. @example
  6377. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6378. @end example
  6379. @item
  6380. Generate a fancy enigmatic moving light:
  6381. @example
  6382. 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
  6383. @end example
  6384. @item
  6385. Generate a quick emboss effect:
  6386. @example
  6387. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6388. @end example
  6389. @item
  6390. Modify RGB components depending on pixel position:
  6391. @example
  6392. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6393. @end example
  6394. @item
  6395. Create a radial gradient that is the same size as the input (also see
  6396. the @ref{vignette} filter):
  6397. @example
  6398. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6399. @end example
  6400. @end itemize
  6401. @section gradfun
  6402. Fix the banding artifacts that are sometimes introduced into nearly flat
  6403. regions by truncation to 8-bit color depth.
  6404. Interpolate the gradients that should go where the bands are, and
  6405. dither them.
  6406. It is designed for playback only. Do not use it prior to
  6407. lossy compression, because compression tends to lose the dither and
  6408. bring back the bands.
  6409. It accepts the following parameters:
  6410. @table @option
  6411. @item strength
  6412. The maximum amount by which the filter will change any one pixel. This is also
  6413. the threshold for detecting nearly flat regions. Acceptable values range from
  6414. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6415. valid range.
  6416. @item radius
  6417. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6418. gradients, but also prevents the filter from modifying the pixels near detailed
  6419. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6420. values will be clipped to the valid range.
  6421. @end table
  6422. Alternatively, the options can be specified as a flat string:
  6423. @var{strength}[:@var{radius}]
  6424. @subsection Examples
  6425. @itemize
  6426. @item
  6427. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6428. @example
  6429. gradfun=3.5:8
  6430. @end example
  6431. @item
  6432. Specify radius, omitting the strength (which will fall-back to the default
  6433. value):
  6434. @example
  6435. gradfun=radius=8
  6436. @end example
  6437. @end itemize
  6438. @anchor{haldclut}
  6439. @section haldclut
  6440. Apply a Hald CLUT to a video stream.
  6441. First input is the video stream to process, and second one is the Hald CLUT.
  6442. The Hald CLUT input can be a simple picture or a complete video stream.
  6443. The filter accepts the following options:
  6444. @table @option
  6445. @item shortest
  6446. Force termination when the shortest input terminates. Default is @code{0}.
  6447. @item repeatlast
  6448. Continue applying the last CLUT after the end of the stream. A value of
  6449. @code{0} disable the filter after the last frame of the CLUT is reached.
  6450. Default is @code{1}.
  6451. @end table
  6452. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6453. filters share the same internals).
  6454. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6455. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6456. @subsection Workflow examples
  6457. @subsubsection Hald CLUT video stream
  6458. Generate an identity Hald CLUT stream altered with various effects:
  6459. @example
  6460. 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
  6461. @end example
  6462. Note: make sure you use a lossless codec.
  6463. Then use it with @code{haldclut} to apply it on some random stream:
  6464. @example
  6465. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6466. @end example
  6467. The Hald CLUT will be applied to the 10 first seconds (duration of
  6468. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6469. to the remaining frames of the @code{mandelbrot} stream.
  6470. @subsubsection Hald CLUT with preview
  6471. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6472. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6473. biggest possible square starting at the top left of the picture. The remaining
  6474. padding pixels (bottom or right) will be ignored. This area can be used to add
  6475. a preview of the Hald CLUT.
  6476. Typically, the following generated Hald CLUT will be supported by the
  6477. @code{haldclut} filter:
  6478. @example
  6479. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6480. pad=iw+320 [padded_clut];
  6481. smptebars=s=320x256, split [a][b];
  6482. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6483. [main][b] overlay=W-320" -frames:v 1 clut.png
  6484. @end example
  6485. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6486. bars are displayed on the right-top, and below the same color bars processed by
  6487. the color changes.
  6488. Then, the effect of this Hald CLUT can be visualized with:
  6489. @example
  6490. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6491. @end example
  6492. @section hdcd
  6493. Decodes high definition audio cd data. 16-Bit PCM stream containing hdcd flags
  6494. is converted to 20-bit PCM stream.
  6495. @section hflip
  6496. Flip the input video horizontally.
  6497. For example, to horizontally flip the input video with @command{ffmpeg}:
  6498. @example
  6499. ffmpeg -i in.avi -vf "hflip" out.avi
  6500. @end example
  6501. @section histeq
  6502. This filter applies a global color histogram equalization on a
  6503. per-frame basis.
  6504. It can be used to correct video that has a compressed range of pixel
  6505. intensities. The filter redistributes the pixel intensities to
  6506. equalize their distribution across the intensity range. It may be
  6507. viewed as an "automatically adjusting contrast filter". This filter is
  6508. useful only for correcting degraded or poorly captured source
  6509. video.
  6510. The filter accepts the following options:
  6511. @table @option
  6512. @item strength
  6513. Determine the amount of equalization to be applied. As the strength
  6514. is reduced, the distribution of pixel intensities more-and-more
  6515. approaches that of the input frame. The value must be a float number
  6516. in the range [0,1] and defaults to 0.200.
  6517. @item intensity
  6518. Set the maximum intensity that can generated and scale the output
  6519. values appropriately. The strength should be set as desired and then
  6520. the intensity can be limited if needed to avoid washing-out. The value
  6521. must be a float number in the range [0,1] and defaults to 0.210.
  6522. @item antibanding
  6523. Set the antibanding level. If enabled the filter will randomly vary
  6524. the luminance of output pixels by a small amount to avoid banding of
  6525. the histogram. Possible values are @code{none}, @code{weak} or
  6526. @code{strong}. It defaults to @code{none}.
  6527. @end table
  6528. @section histogram
  6529. Compute and draw a color distribution histogram for the input video.
  6530. The computed histogram is a representation of the color component
  6531. distribution in an image.
  6532. Standard histogram displays the color components distribution in an image.
  6533. Displays color graph for each color component. Shows distribution of
  6534. the Y, U, V, A or R, G, B components, depending on input format, in the
  6535. current frame. Below each graph a color component scale meter is shown.
  6536. The filter accepts the following options:
  6537. @table @option
  6538. @item level_height
  6539. Set height of level. Default value is @code{200}.
  6540. Allowed range is [50, 2048].
  6541. @item scale_height
  6542. Set height of color scale. Default value is @code{12}.
  6543. Allowed range is [0, 40].
  6544. @item display_mode
  6545. Set display mode.
  6546. It accepts the following values:
  6547. @table @samp
  6548. @item parade
  6549. Per color component graphs are placed below each other.
  6550. @item overlay
  6551. Presents information identical to that in the @code{parade}, except
  6552. that the graphs representing color components are superimposed directly
  6553. over one another.
  6554. @end table
  6555. Default is @code{parade}.
  6556. @item levels_mode
  6557. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6558. Default is @code{linear}.
  6559. @item components
  6560. Set what color components to display.
  6561. Default is @code{7}.
  6562. @end table
  6563. @subsection Examples
  6564. @itemize
  6565. @item
  6566. Calculate and draw histogram:
  6567. @example
  6568. ffplay -i input -vf histogram
  6569. @end example
  6570. @end itemize
  6571. @anchor{hqdn3d}
  6572. @section hqdn3d
  6573. This is a high precision/quality 3d denoise filter. It aims to reduce
  6574. image noise, producing smooth images and making still images really
  6575. still. It should enhance compressibility.
  6576. It accepts the following optional parameters:
  6577. @table @option
  6578. @item luma_spatial
  6579. A non-negative floating point number which specifies spatial luma strength.
  6580. It defaults to 4.0.
  6581. @item chroma_spatial
  6582. A non-negative floating point number which specifies spatial chroma strength.
  6583. It defaults to 3.0*@var{luma_spatial}/4.0.
  6584. @item luma_tmp
  6585. A floating point number which specifies luma temporal strength. It defaults to
  6586. 6.0*@var{luma_spatial}/4.0.
  6587. @item chroma_tmp
  6588. A floating point number which specifies chroma temporal strength. It defaults to
  6589. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6590. @end table
  6591. @anchor{hwupload_cuda}
  6592. @section hwupload_cuda
  6593. Upload system memory frames to a CUDA device.
  6594. It accepts the following optional parameters:
  6595. @table @option
  6596. @item device
  6597. The number of the CUDA device to use
  6598. @end table
  6599. @section hqx
  6600. Apply a high-quality magnification filter designed for pixel art. This filter
  6601. was originally created by Maxim Stepin.
  6602. It accepts the following option:
  6603. @table @option
  6604. @item n
  6605. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6606. @code{hq3x} and @code{4} for @code{hq4x}.
  6607. Default is @code{3}.
  6608. @end table
  6609. @section hstack
  6610. Stack input videos horizontally.
  6611. All streams must be of same pixel format and of same height.
  6612. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6613. to create same output.
  6614. The filter accept the following option:
  6615. @table @option
  6616. @item inputs
  6617. Set number of input streams. Default is 2.
  6618. @item shortest
  6619. If set to 1, force the output to terminate when the shortest input
  6620. terminates. Default value is 0.
  6621. @end table
  6622. @section hue
  6623. Modify the hue and/or the saturation of the input.
  6624. It accepts the following parameters:
  6625. @table @option
  6626. @item h
  6627. Specify the hue angle as a number of degrees. It accepts an expression,
  6628. and defaults to "0".
  6629. @item s
  6630. Specify the saturation in the [-10,10] range. It accepts an expression and
  6631. defaults to "1".
  6632. @item H
  6633. Specify the hue angle as a number of radians. It accepts an
  6634. expression, and defaults to "0".
  6635. @item b
  6636. Specify the brightness in the [-10,10] range. It accepts an expression and
  6637. defaults to "0".
  6638. @end table
  6639. @option{h} and @option{H} are mutually exclusive, and can't be
  6640. specified at the same time.
  6641. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6642. expressions containing the following constants:
  6643. @table @option
  6644. @item n
  6645. frame count of the input frame starting from 0
  6646. @item pts
  6647. presentation timestamp of the input frame expressed in time base units
  6648. @item r
  6649. frame rate of the input video, NAN if the input frame rate is unknown
  6650. @item t
  6651. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6652. @item tb
  6653. time base of the input video
  6654. @end table
  6655. @subsection Examples
  6656. @itemize
  6657. @item
  6658. Set the hue to 90 degrees and the saturation to 1.0:
  6659. @example
  6660. hue=h=90:s=1
  6661. @end example
  6662. @item
  6663. Same command but expressing the hue in radians:
  6664. @example
  6665. hue=H=PI/2:s=1
  6666. @end example
  6667. @item
  6668. Rotate hue and make the saturation swing between 0
  6669. and 2 over a period of 1 second:
  6670. @example
  6671. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6672. @end example
  6673. @item
  6674. Apply a 3 seconds saturation fade-in effect starting at 0:
  6675. @example
  6676. hue="s=min(t/3\,1)"
  6677. @end example
  6678. The general fade-in expression can be written as:
  6679. @example
  6680. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6681. @end example
  6682. @item
  6683. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6684. @example
  6685. hue="s=max(0\, min(1\, (8-t)/3))"
  6686. @end example
  6687. The general fade-out expression can be written as:
  6688. @example
  6689. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6690. @end example
  6691. @end itemize
  6692. @subsection Commands
  6693. This filter supports the following commands:
  6694. @table @option
  6695. @item b
  6696. @item s
  6697. @item h
  6698. @item H
  6699. Modify the hue and/or the saturation and/or brightness of the input video.
  6700. The command accepts the same syntax of the corresponding option.
  6701. If the specified expression is not valid, it is kept at its current
  6702. value.
  6703. @end table
  6704. @section idet
  6705. Detect video interlacing type.
  6706. This filter tries to detect if the input frames are interlaced, progressive,
  6707. top or bottom field first. It will also try to detect fields that are
  6708. repeated between adjacent frames (a sign of telecine).
  6709. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6710. Multiple frame detection incorporates the classification history of previous frames.
  6711. The filter will log these metadata values:
  6712. @table @option
  6713. @item single.current_frame
  6714. Detected type of current frame using single-frame detection. One of:
  6715. ``tff'' (top field first), ``bff'' (bottom field first),
  6716. ``progressive'', or ``undetermined''
  6717. @item single.tff
  6718. Cumulative number of frames detected as top field first using single-frame detection.
  6719. @item multiple.tff
  6720. Cumulative number of frames detected as top field first using multiple-frame detection.
  6721. @item single.bff
  6722. Cumulative number of frames detected as bottom field first using single-frame detection.
  6723. @item multiple.current_frame
  6724. Detected type of current frame using multiple-frame detection. One of:
  6725. ``tff'' (top field first), ``bff'' (bottom field first),
  6726. ``progressive'', or ``undetermined''
  6727. @item multiple.bff
  6728. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6729. @item single.progressive
  6730. Cumulative number of frames detected as progressive using single-frame detection.
  6731. @item multiple.progressive
  6732. Cumulative number of frames detected as progressive using multiple-frame detection.
  6733. @item single.undetermined
  6734. Cumulative number of frames that could not be classified using single-frame detection.
  6735. @item multiple.undetermined
  6736. Cumulative number of frames that could not be classified using multiple-frame detection.
  6737. @item repeated.current_frame
  6738. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6739. @item repeated.neither
  6740. Cumulative number of frames with no repeated field.
  6741. @item repeated.top
  6742. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6743. @item repeated.bottom
  6744. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6745. @end table
  6746. The filter accepts the following options:
  6747. @table @option
  6748. @item intl_thres
  6749. Set interlacing threshold.
  6750. @item prog_thres
  6751. Set progressive threshold.
  6752. @item rep_thres
  6753. Threshold for repeated field detection.
  6754. @item half_life
  6755. Number of frames after which a given frame's contribution to the
  6756. statistics is halved (i.e., it contributes only 0.5 to its
  6757. classification). The default of 0 means that all frames seen are given
  6758. full weight of 1.0 forever.
  6759. @item analyze_interlaced_flag
  6760. When this is not 0 then idet will use the specified number of frames to determine
  6761. if the interlaced flag is accurate, it will not count undetermined frames.
  6762. If the flag is found to be accurate it will be used without any further
  6763. computations, if it is found to be inaccurate it will be cleared without any
  6764. further computations. This allows inserting the idet filter as a low computational
  6765. method to clean up the interlaced flag
  6766. @end table
  6767. @section il
  6768. Deinterleave or interleave fields.
  6769. This filter allows one to process interlaced images fields without
  6770. deinterlacing them. Deinterleaving splits the input frame into 2
  6771. fields (so called half pictures). Odd lines are moved to the top
  6772. half of the output image, even lines to the bottom half.
  6773. You can process (filter) them independently and then re-interleave them.
  6774. The filter accepts the following options:
  6775. @table @option
  6776. @item luma_mode, l
  6777. @item chroma_mode, c
  6778. @item alpha_mode, a
  6779. Available values for @var{luma_mode}, @var{chroma_mode} and
  6780. @var{alpha_mode} are:
  6781. @table @samp
  6782. @item none
  6783. Do nothing.
  6784. @item deinterleave, d
  6785. Deinterleave fields, placing one above the other.
  6786. @item interleave, i
  6787. Interleave fields. Reverse the effect of deinterleaving.
  6788. @end table
  6789. Default value is @code{none}.
  6790. @item luma_swap, ls
  6791. @item chroma_swap, cs
  6792. @item alpha_swap, as
  6793. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6794. @end table
  6795. @section inflate
  6796. Apply inflate effect to the video.
  6797. This filter replaces the pixel by the local(3x3) average by taking into account
  6798. only values higher than the pixel.
  6799. It accepts the following options:
  6800. @table @option
  6801. @item threshold0
  6802. @item threshold1
  6803. @item threshold2
  6804. @item threshold3
  6805. Limit the maximum change for each plane, default is 65535.
  6806. If 0, plane will remain unchanged.
  6807. @end table
  6808. @section interlace
  6809. Simple interlacing filter from progressive contents. This interleaves upper (or
  6810. lower) lines from odd frames with lower (or upper) lines from even frames,
  6811. halving the frame rate and preserving image height.
  6812. @example
  6813. Original Original New Frame
  6814. Frame 'j' Frame 'j+1' (tff)
  6815. ========== =========== ==================
  6816. Line 0 --------------------> Frame 'j' Line 0
  6817. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6818. Line 2 ---------------------> Frame 'j' Line 2
  6819. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6820. ... ... ...
  6821. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6822. @end example
  6823. It accepts the following optional parameters:
  6824. @table @option
  6825. @item scan
  6826. This determines whether the interlaced frame is taken from the even
  6827. (tff - default) or odd (bff) lines of the progressive frame.
  6828. @item lowpass
  6829. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6830. interlacing and reduce moire patterns.
  6831. @end table
  6832. @section kerndeint
  6833. Deinterlace input video by applying Donald Graft's adaptive kernel
  6834. deinterling. Work on interlaced parts of a video to produce
  6835. progressive frames.
  6836. The description of the accepted parameters follows.
  6837. @table @option
  6838. @item thresh
  6839. Set the threshold which affects the filter's tolerance when
  6840. determining if a pixel line must be processed. It must be an integer
  6841. in the range [0,255] and defaults to 10. A value of 0 will result in
  6842. applying the process on every pixels.
  6843. @item map
  6844. Paint pixels exceeding the threshold value to white if set to 1.
  6845. Default is 0.
  6846. @item order
  6847. Set the fields order. Swap fields if set to 1, leave fields alone if
  6848. 0. Default is 0.
  6849. @item sharp
  6850. Enable additional sharpening if set to 1. Default is 0.
  6851. @item twoway
  6852. Enable twoway sharpening if set to 1. Default is 0.
  6853. @end table
  6854. @subsection Examples
  6855. @itemize
  6856. @item
  6857. Apply default values:
  6858. @example
  6859. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6860. @end example
  6861. @item
  6862. Enable additional sharpening:
  6863. @example
  6864. kerndeint=sharp=1
  6865. @end example
  6866. @item
  6867. Paint processed pixels in white:
  6868. @example
  6869. kerndeint=map=1
  6870. @end example
  6871. @end itemize
  6872. @section lenscorrection
  6873. Correct radial lens distortion
  6874. This filter can be used to correct for radial distortion as can result from the use
  6875. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6876. one can use tools available for example as part of opencv or simply trial-and-error.
  6877. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6878. and extract the k1 and k2 coefficients from the resulting matrix.
  6879. Note that effectively the same filter is available in the open-source tools Krita and
  6880. Digikam from the KDE project.
  6881. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6882. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6883. brightness distribution, so you may want to use both filters together in certain
  6884. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6885. be applied before or after lens correction.
  6886. @subsection Options
  6887. The filter accepts the following options:
  6888. @table @option
  6889. @item cx
  6890. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6891. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6892. width.
  6893. @item cy
  6894. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6895. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6896. height.
  6897. @item k1
  6898. Coefficient of the quadratic correction term. 0.5 means no correction.
  6899. @item k2
  6900. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6901. @end table
  6902. The formula that generates the correction is:
  6903. @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)
  6904. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6905. distances from the focal point in the source and target images, respectively.
  6906. @section loop, aloop
  6907. Loop video frames or audio samples.
  6908. Those filters accepts the following options:
  6909. @table @option
  6910. @item loop
  6911. Set the number of loops.
  6912. @item size
  6913. Set maximal size in number of frames for @code{loop} filter or maximal number
  6914. of samples in case of @code{aloop} filter.
  6915. @item start
  6916. Set first frame of loop for @code{loop} filter or first sample of loop in case
  6917. of @code{aloop} filter.
  6918. @end table
  6919. @anchor{lut3d}
  6920. @section lut3d
  6921. Apply a 3D LUT to an input video.
  6922. The filter accepts the following options:
  6923. @table @option
  6924. @item file
  6925. Set the 3D LUT file name.
  6926. Currently supported formats:
  6927. @table @samp
  6928. @item 3dl
  6929. AfterEffects
  6930. @item cube
  6931. Iridas
  6932. @item dat
  6933. DaVinci
  6934. @item m3d
  6935. Pandora
  6936. @end table
  6937. @item interp
  6938. Select interpolation mode.
  6939. Available values are:
  6940. @table @samp
  6941. @item nearest
  6942. Use values from the nearest defined point.
  6943. @item trilinear
  6944. Interpolate values using the 8 points defining a cube.
  6945. @item tetrahedral
  6946. Interpolate values using a tetrahedron.
  6947. @end table
  6948. @end table
  6949. @section lut, lutrgb, lutyuv
  6950. Compute a look-up table for binding each pixel component input value
  6951. to an output value, and apply it to the input video.
  6952. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6953. to an RGB input video.
  6954. These filters accept the following parameters:
  6955. @table @option
  6956. @item c0
  6957. set first pixel component expression
  6958. @item c1
  6959. set second pixel component expression
  6960. @item c2
  6961. set third pixel component expression
  6962. @item c3
  6963. set fourth pixel component expression, corresponds to the alpha component
  6964. @item r
  6965. set red component expression
  6966. @item g
  6967. set green component expression
  6968. @item b
  6969. set blue component expression
  6970. @item a
  6971. alpha component expression
  6972. @item y
  6973. set Y/luminance component expression
  6974. @item u
  6975. set U/Cb component expression
  6976. @item v
  6977. set V/Cr component expression
  6978. @end table
  6979. Each of them specifies the expression to use for computing the lookup table for
  6980. the corresponding pixel component values.
  6981. The exact component associated to each of the @var{c*} options depends on the
  6982. format in input.
  6983. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6984. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6985. The expressions can contain the following constants and functions:
  6986. @table @option
  6987. @item w
  6988. @item h
  6989. The input width and height.
  6990. @item val
  6991. The input value for the pixel component.
  6992. @item clipval
  6993. The input value, clipped to the @var{minval}-@var{maxval} range.
  6994. @item maxval
  6995. The maximum value for the pixel component.
  6996. @item minval
  6997. The minimum value for the pixel component.
  6998. @item negval
  6999. The negated value for the pixel component value, clipped to the
  7000. @var{minval}-@var{maxval} range; it corresponds to the expression
  7001. "maxval-clipval+minval".
  7002. @item clip(val)
  7003. The computed value in @var{val}, clipped to the
  7004. @var{minval}-@var{maxval} range.
  7005. @item gammaval(gamma)
  7006. The computed gamma correction value of the pixel component value,
  7007. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7008. expression
  7009. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7010. @end table
  7011. All expressions default to "val".
  7012. @subsection Examples
  7013. @itemize
  7014. @item
  7015. Negate input video:
  7016. @example
  7017. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7018. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7019. @end example
  7020. The above is the same as:
  7021. @example
  7022. lutrgb="r=negval:g=negval:b=negval"
  7023. lutyuv="y=negval:u=negval:v=negval"
  7024. @end example
  7025. @item
  7026. Negate luminance:
  7027. @example
  7028. lutyuv=y=negval
  7029. @end example
  7030. @item
  7031. Remove chroma components, turning the video into a graytone image:
  7032. @example
  7033. lutyuv="u=128:v=128"
  7034. @end example
  7035. @item
  7036. Apply a luma burning effect:
  7037. @example
  7038. lutyuv="y=2*val"
  7039. @end example
  7040. @item
  7041. Remove green and blue components:
  7042. @example
  7043. lutrgb="g=0:b=0"
  7044. @end example
  7045. @item
  7046. Set a constant alpha channel value on input:
  7047. @example
  7048. format=rgba,lutrgb=a="maxval-minval/2"
  7049. @end example
  7050. @item
  7051. Correct luminance gamma by a factor of 0.5:
  7052. @example
  7053. lutyuv=y=gammaval(0.5)
  7054. @end example
  7055. @item
  7056. Discard least significant bits of luma:
  7057. @example
  7058. lutyuv=y='bitand(val, 128+64+32)'
  7059. @end example
  7060. @end itemize
  7061. @section maskedmerge
  7062. Merge the first input stream with the second input stream using per pixel
  7063. weights in the third input stream.
  7064. A value of 0 in the third stream pixel component means that pixel component
  7065. from first stream is returned unchanged, while maximum value (eg. 255 for
  7066. 8-bit videos) means that pixel component from second stream is returned
  7067. unchanged. Intermediate values define the amount of merging between both
  7068. input stream's pixel components.
  7069. This filter accepts the following options:
  7070. @table @option
  7071. @item planes
  7072. Set which planes will be processed as bitmap, unprocessed planes will be
  7073. copied from first stream.
  7074. By default value 0xf, all planes will be processed.
  7075. @end table
  7076. @section mcdeint
  7077. Apply motion-compensation deinterlacing.
  7078. It needs one field per frame as input and must thus be used together
  7079. with yadif=1/3 or equivalent.
  7080. This filter accepts the following options:
  7081. @table @option
  7082. @item mode
  7083. Set the deinterlacing mode.
  7084. It accepts one of the following values:
  7085. @table @samp
  7086. @item fast
  7087. @item medium
  7088. @item slow
  7089. use iterative motion estimation
  7090. @item extra_slow
  7091. like @samp{slow}, but use multiple reference frames.
  7092. @end table
  7093. Default value is @samp{fast}.
  7094. @item parity
  7095. Set the picture field parity assumed for the input video. It must be
  7096. one of the following values:
  7097. @table @samp
  7098. @item 0, tff
  7099. assume top field first
  7100. @item 1, bff
  7101. assume bottom field first
  7102. @end table
  7103. Default value is @samp{bff}.
  7104. @item qp
  7105. Set per-block quantization parameter (QP) used by the internal
  7106. encoder.
  7107. Higher values should result in a smoother motion vector field but less
  7108. optimal individual vectors. Default value is 1.
  7109. @end table
  7110. @section mergeplanes
  7111. Merge color channel components from several video streams.
  7112. The filter accepts up to 4 input streams, and merge selected input
  7113. planes to the output video.
  7114. This filter accepts the following options:
  7115. @table @option
  7116. @item mapping
  7117. Set input to output plane mapping. Default is @code{0}.
  7118. The mappings is specified as a bitmap. It should be specified as a
  7119. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7120. mapping for the first plane of the output stream. 'A' sets the number of
  7121. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7122. corresponding input to use (from 0 to 3). The rest of the mappings is
  7123. similar, 'Bb' describes the mapping for the output stream second
  7124. plane, 'Cc' describes the mapping for the output stream third plane and
  7125. 'Dd' describes the mapping for the output stream fourth plane.
  7126. @item format
  7127. Set output pixel format. Default is @code{yuva444p}.
  7128. @end table
  7129. @subsection Examples
  7130. @itemize
  7131. @item
  7132. Merge three gray video streams of same width and height into single video stream:
  7133. @example
  7134. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7135. @end example
  7136. @item
  7137. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7138. @example
  7139. [a0][a1]mergeplanes=0x00010210:yuva444p
  7140. @end example
  7141. @item
  7142. Swap Y and A plane in yuva444p stream:
  7143. @example
  7144. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7145. @end example
  7146. @item
  7147. Swap U and V plane in yuv420p stream:
  7148. @example
  7149. format=yuv420p,mergeplanes=0x000201:yuv420p
  7150. @end example
  7151. @item
  7152. Cast a rgb24 clip to yuv444p:
  7153. @example
  7154. format=rgb24,mergeplanes=0x000102:yuv444p
  7155. @end example
  7156. @end itemize
  7157. @section metadata, ametadata
  7158. Manipulate frame metadata.
  7159. This filter accepts the following options:
  7160. @table @option
  7161. @item mode
  7162. Set mode of operation of the filter.
  7163. Can be one of the following:
  7164. @table @samp
  7165. @item select
  7166. If both @code{value} and @code{key} is set, select frames
  7167. which have such metadata. If only @code{key} is set, select
  7168. every frame that has such key in metadata.
  7169. @item add
  7170. Add new metadata @code{key} and @code{value}. If key is already available
  7171. do nothing.
  7172. @item modify
  7173. Modify value of already present key.
  7174. @item delete
  7175. If @code{value} is set, delete only keys that have such value.
  7176. Otherwise, delete key.
  7177. @item print
  7178. Print key and its value if metadata was found. If @code{key} is not set print all
  7179. metadata values available in frame.
  7180. @end table
  7181. @item key
  7182. Set key used with all modes. Must be set for all modes except @code{print}.
  7183. @item value
  7184. Set metadata value which will be used. This option is mandatory for
  7185. @code{modify} and @code{add} mode.
  7186. @item function
  7187. Which function to use when comparing metadata value and @code{value}.
  7188. Can be one of following:
  7189. @table @samp
  7190. @item same_str
  7191. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  7192. @item starts_with
  7193. Values are interpreted as strings, returns true if metadata value starts with
  7194. the @code{value} option string.
  7195. @item less
  7196. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  7197. @item equal
  7198. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  7199. @item greater
  7200. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  7201. @item expr
  7202. Values are interpreted as floats, returns true if expression from option @code{expr}
  7203. evaluates to true.
  7204. @end table
  7205. @item expr
  7206. Set expression which is used when @code{function} is set to @code{expr}.
  7207. The expression is evaluated through the eval API and can contain the following
  7208. constants:
  7209. @table @option
  7210. @item VALUE1
  7211. Float representation of @code{value} from metadata key.
  7212. @item VALUE2
  7213. Float representation of @code{value} as supplied by user in @code{value} option.
  7214. @end table
  7215. @item file
  7216. If specified in @code{print} mode, output is written to the named file. When
  7217. filename equals "-" data is written to standard output.
  7218. If @code{file} option is not set, output is written to the log with AV_LOG_INFO
  7219. loglevel.
  7220. @end table
  7221. @subsection Examples
  7222. @itemize
  7223. @item
  7224. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  7225. between 0 and 1.
  7226. @example
  7227. @end example
  7228. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  7229. @end itemize
  7230. @section mpdecimate
  7231. Drop frames that do not differ greatly from the previous frame in
  7232. order to reduce frame rate.
  7233. The main use of this filter is for very-low-bitrate encoding
  7234. (e.g. streaming over dialup modem), but it could in theory be used for
  7235. fixing movies that were inverse-telecined incorrectly.
  7236. A description of the accepted options follows.
  7237. @table @option
  7238. @item max
  7239. Set the maximum number of consecutive frames which can be dropped (if
  7240. positive), or the minimum interval between dropped frames (if
  7241. negative). If the value is 0, the frame is dropped unregarding the
  7242. number of previous sequentially dropped frames.
  7243. Default value is 0.
  7244. @item hi
  7245. @item lo
  7246. @item frac
  7247. Set the dropping threshold values.
  7248. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7249. represent actual pixel value differences, so a threshold of 64
  7250. corresponds to 1 unit of difference for each pixel, or the same spread
  7251. out differently over the block.
  7252. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7253. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7254. meaning the whole image) differ by more than a threshold of @option{lo}.
  7255. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7256. 64*5, and default value for @option{frac} is 0.33.
  7257. @end table
  7258. @section negate
  7259. Negate input video.
  7260. It accepts an integer in input; if non-zero it negates the
  7261. alpha component (if available). The default value in input is 0.
  7262. @section nnedi
  7263. Deinterlace video using neural network edge directed interpolation.
  7264. This filter accepts the following options:
  7265. @table @option
  7266. @item weights
  7267. Mandatory option, without binary file filter can not work.
  7268. Currently file can be found here:
  7269. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7270. @item deint
  7271. Set which frames to deinterlace, by default it is @code{all}.
  7272. Can be @code{all} or @code{interlaced}.
  7273. @item field
  7274. Set mode of operation.
  7275. Can be one of the following:
  7276. @table @samp
  7277. @item af
  7278. Use frame flags, both fields.
  7279. @item a
  7280. Use frame flags, single field.
  7281. @item t
  7282. Use top field only.
  7283. @item b
  7284. Use bottom field only.
  7285. @item tf
  7286. Use both fields, top first.
  7287. @item bf
  7288. Use both fields, bottom first.
  7289. @end table
  7290. @item planes
  7291. Set which planes to process, by default filter process all frames.
  7292. @item nsize
  7293. Set size of local neighborhood around each pixel, used by the predictor neural
  7294. network.
  7295. Can be one of the following:
  7296. @table @samp
  7297. @item s8x6
  7298. @item s16x6
  7299. @item s32x6
  7300. @item s48x6
  7301. @item s8x4
  7302. @item s16x4
  7303. @item s32x4
  7304. @end table
  7305. @item nns
  7306. Set the number of neurons in predicctor neural network.
  7307. Can be one of the following:
  7308. @table @samp
  7309. @item n16
  7310. @item n32
  7311. @item n64
  7312. @item n128
  7313. @item n256
  7314. @end table
  7315. @item qual
  7316. Controls the number of different neural network predictions that are blended
  7317. together to compute the final output value. Can be @code{fast}, default or
  7318. @code{slow}.
  7319. @item etype
  7320. Set which set of weights to use in the predictor.
  7321. Can be one of the following:
  7322. @table @samp
  7323. @item a
  7324. weights trained to minimize absolute error
  7325. @item s
  7326. weights trained to minimize squared error
  7327. @end table
  7328. @item pscrn
  7329. Controls whether or not the prescreener neural network is used to decide
  7330. which pixels should be processed by the predictor neural network and which
  7331. can be handled by simple cubic interpolation.
  7332. The prescreener is trained to know whether cubic interpolation will be
  7333. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7334. The computational complexity of the prescreener nn is much less than that of
  7335. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7336. using the prescreener generally results in much faster processing.
  7337. The prescreener is pretty accurate, so the difference between using it and not
  7338. using it is almost always unnoticeable.
  7339. Can be one of the following:
  7340. @table @samp
  7341. @item none
  7342. @item original
  7343. @item new
  7344. @end table
  7345. Default is @code{new}.
  7346. @item fapprox
  7347. Set various debugging flags.
  7348. @end table
  7349. @section noformat
  7350. Force libavfilter not to use any of the specified pixel formats for the
  7351. input to the next filter.
  7352. It accepts the following parameters:
  7353. @table @option
  7354. @item pix_fmts
  7355. A '|'-separated list of pixel format names, such as
  7356. apix_fmts=yuv420p|monow|rgb24".
  7357. @end table
  7358. @subsection Examples
  7359. @itemize
  7360. @item
  7361. Force libavfilter to use a format different from @var{yuv420p} for the
  7362. input to the vflip filter:
  7363. @example
  7364. noformat=pix_fmts=yuv420p,vflip
  7365. @end example
  7366. @item
  7367. Convert the input video to any of the formats not contained in the list:
  7368. @example
  7369. noformat=yuv420p|yuv444p|yuv410p
  7370. @end example
  7371. @end itemize
  7372. @section noise
  7373. Add noise on video input frame.
  7374. The filter accepts the following options:
  7375. @table @option
  7376. @item all_seed
  7377. @item c0_seed
  7378. @item c1_seed
  7379. @item c2_seed
  7380. @item c3_seed
  7381. Set noise seed for specific pixel component or all pixel components in case
  7382. of @var{all_seed}. Default value is @code{123457}.
  7383. @item all_strength, alls
  7384. @item c0_strength, c0s
  7385. @item c1_strength, c1s
  7386. @item c2_strength, c2s
  7387. @item c3_strength, c3s
  7388. Set noise strength for specific pixel component or all pixel components in case
  7389. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7390. @item all_flags, allf
  7391. @item c0_flags, c0f
  7392. @item c1_flags, c1f
  7393. @item c2_flags, c2f
  7394. @item c3_flags, c3f
  7395. Set pixel component flags or set flags for all components if @var{all_flags}.
  7396. Available values for component flags are:
  7397. @table @samp
  7398. @item a
  7399. averaged temporal noise (smoother)
  7400. @item p
  7401. mix random noise with a (semi)regular pattern
  7402. @item t
  7403. temporal noise (noise pattern changes between frames)
  7404. @item u
  7405. uniform noise (gaussian otherwise)
  7406. @end table
  7407. @end table
  7408. @subsection Examples
  7409. Add temporal and uniform noise to input video:
  7410. @example
  7411. noise=alls=20:allf=t+u
  7412. @end example
  7413. @section null
  7414. Pass the video source unchanged to the output.
  7415. @section ocr
  7416. Optical Character Recognition
  7417. This filter uses Tesseract for optical character recognition.
  7418. It accepts the following options:
  7419. @table @option
  7420. @item datapath
  7421. Set datapath to tesseract data. Default is to use whatever was
  7422. set at installation.
  7423. @item language
  7424. Set language, default is "eng".
  7425. @item whitelist
  7426. Set character whitelist.
  7427. @item blacklist
  7428. Set character blacklist.
  7429. @end table
  7430. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7431. @section ocv
  7432. Apply a video transform using libopencv.
  7433. To enable this filter, install the libopencv library and headers and
  7434. configure FFmpeg with @code{--enable-libopencv}.
  7435. It accepts the following parameters:
  7436. @table @option
  7437. @item filter_name
  7438. The name of the libopencv filter to apply.
  7439. @item filter_params
  7440. The parameters to pass to the libopencv filter. If not specified, the default
  7441. values are assumed.
  7442. @end table
  7443. Refer to the official libopencv documentation for more precise
  7444. information:
  7445. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7446. Several libopencv filters are supported; see the following subsections.
  7447. @anchor{dilate}
  7448. @subsection dilate
  7449. Dilate an image by using a specific structuring element.
  7450. It corresponds to the libopencv function @code{cvDilate}.
  7451. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7452. @var{struct_el} represents a structuring element, and has the syntax:
  7453. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7454. @var{cols} and @var{rows} represent the number of columns and rows of
  7455. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7456. point, and @var{shape} the shape for the structuring element. @var{shape}
  7457. must be "rect", "cross", "ellipse", or "custom".
  7458. If the value for @var{shape} is "custom", it must be followed by a
  7459. string of the form "=@var{filename}". The file with name
  7460. @var{filename} is assumed to represent a binary image, with each
  7461. printable character corresponding to a bright pixel. When a custom
  7462. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7463. or columns and rows of the read file are assumed instead.
  7464. The default value for @var{struct_el} is "3x3+0x0/rect".
  7465. @var{nb_iterations} specifies the number of times the transform is
  7466. applied to the image, and defaults to 1.
  7467. Some examples:
  7468. @example
  7469. # Use the default values
  7470. ocv=dilate
  7471. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7472. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7473. # Read the shape from the file diamond.shape, iterating two times.
  7474. # The file diamond.shape may contain a pattern of characters like this
  7475. # *
  7476. # ***
  7477. # *****
  7478. # ***
  7479. # *
  7480. # The specified columns and rows are ignored
  7481. # but the anchor point coordinates are not
  7482. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7483. @end example
  7484. @subsection erode
  7485. Erode an image by using a specific structuring element.
  7486. It corresponds to the libopencv function @code{cvErode}.
  7487. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7488. with the same syntax and semantics as the @ref{dilate} filter.
  7489. @subsection smooth
  7490. Smooth the input video.
  7491. The filter takes the following parameters:
  7492. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7493. @var{type} is the type of smooth filter to apply, and must be one of
  7494. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7495. or "bilateral". The default value is "gaussian".
  7496. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7497. depend on the smooth type. @var{param1} and
  7498. @var{param2} accept integer positive values or 0. @var{param3} and
  7499. @var{param4} accept floating point values.
  7500. The default value for @var{param1} is 3. The default value for the
  7501. other parameters is 0.
  7502. These parameters correspond to the parameters assigned to the
  7503. libopencv function @code{cvSmooth}.
  7504. @anchor{overlay}
  7505. @section overlay
  7506. Overlay one video on top of another.
  7507. It takes two inputs and has one output. The first input is the "main"
  7508. video on which the second input is overlaid.
  7509. It accepts the following parameters:
  7510. A description of the accepted options follows.
  7511. @table @option
  7512. @item x
  7513. @item y
  7514. Set the expression for the x and y coordinates of the overlaid video
  7515. on the main video. Default value is "0" for both expressions. In case
  7516. the expression is invalid, it is set to a huge value (meaning that the
  7517. overlay will not be displayed within the output visible area).
  7518. @item eof_action
  7519. The action to take when EOF is encountered on the secondary input; it accepts
  7520. one of the following values:
  7521. @table @option
  7522. @item repeat
  7523. Repeat the last frame (the default).
  7524. @item endall
  7525. End both streams.
  7526. @item pass
  7527. Pass the main input through.
  7528. @end table
  7529. @item eval
  7530. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7531. It accepts the following values:
  7532. @table @samp
  7533. @item init
  7534. only evaluate expressions once during the filter initialization or
  7535. when a command is processed
  7536. @item frame
  7537. evaluate expressions for each incoming frame
  7538. @end table
  7539. Default value is @samp{frame}.
  7540. @item shortest
  7541. If set to 1, force the output to terminate when the shortest input
  7542. terminates. Default value is 0.
  7543. @item format
  7544. Set the format for the output video.
  7545. It accepts the following values:
  7546. @table @samp
  7547. @item yuv420
  7548. force YUV420 output
  7549. @item yuv422
  7550. force YUV422 output
  7551. @item yuv444
  7552. force YUV444 output
  7553. @item rgb
  7554. force RGB output
  7555. @end table
  7556. Default value is @samp{yuv420}.
  7557. @item rgb @emph{(deprecated)}
  7558. If set to 1, force the filter to accept inputs in the RGB
  7559. color space. Default value is 0. This option is deprecated, use
  7560. @option{format} instead.
  7561. @item repeatlast
  7562. If set to 1, force the filter to draw the last overlay frame over the
  7563. main input until the end of the stream. A value of 0 disables this
  7564. behavior. Default value is 1.
  7565. @end table
  7566. The @option{x}, and @option{y} expressions can contain the following
  7567. parameters.
  7568. @table @option
  7569. @item main_w, W
  7570. @item main_h, H
  7571. The main input width and height.
  7572. @item overlay_w, w
  7573. @item overlay_h, h
  7574. The overlay input width and height.
  7575. @item x
  7576. @item y
  7577. The computed values for @var{x} and @var{y}. They are evaluated for
  7578. each new frame.
  7579. @item hsub
  7580. @item vsub
  7581. horizontal and vertical chroma subsample values of the output
  7582. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7583. @var{vsub} is 1.
  7584. @item n
  7585. the number of input frame, starting from 0
  7586. @item pos
  7587. the position in the file of the input frame, NAN if unknown
  7588. @item t
  7589. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7590. @end table
  7591. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7592. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7593. when @option{eval} is set to @samp{init}.
  7594. Be aware that frames are taken from each input video in timestamp
  7595. order, hence, if their initial timestamps differ, it is a good idea
  7596. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7597. have them begin in the same zero timestamp, as the example for
  7598. the @var{movie} filter does.
  7599. You can chain together more overlays but you should test the
  7600. efficiency of such approach.
  7601. @subsection Commands
  7602. This filter supports the following commands:
  7603. @table @option
  7604. @item x
  7605. @item y
  7606. Modify the x and y of the overlay input.
  7607. The command accepts the same syntax of the corresponding option.
  7608. If the specified expression is not valid, it is kept at its current
  7609. value.
  7610. @end table
  7611. @subsection Examples
  7612. @itemize
  7613. @item
  7614. Draw the overlay at 10 pixels from the bottom right corner of the main
  7615. video:
  7616. @example
  7617. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7618. @end example
  7619. Using named options the example above becomes:
  7620. @example
  7621. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7622. @end example
  7623. @item
  7624. Insert a transparent PNG logo in the bottom left corner of the input,
  7625. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7626. @example
  7627. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7628. @end example
  7629. @item
  7630. Insert 2 different transparent PNG logos (second logo on bottom
  7631. right corner) using the @command{ffmpeg} tool:
  7632. @example
  7633. 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
  7634. @end example
  7635. @item
  7636. Add a transparent color layer on top of the main video; @code{WxH}
  7637. must specify the size of the main input to the overlay filter:
  7638. @example
  7639. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7640. @end example
  7641. @item
  7642. Play an original video and a filtered version (here with the deshake
  7643. filter) side by side using the @command{ffplay} tool:
  7644. @example
  7645. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7646. @end example
  7647. The above command is the same as:
  7648. @example
  7649. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7650. @end example
  7651. @item
  7652. Make a sliding overlay appearing from the left to the right top part of the
  7653. screen starting since time 2:
  7654. @example
  7655. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7656. @end example
  7657. @item
  7658. Compose output by putting two input videos side to side:
  7659. @example
  7660. ffmpeg -i left.avi -i right.avi -filter_complex "
  7661. nullsrc=size=200x100 [background];
  7662. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7663. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7664. [background][left] overlay=shortest=1 [background+left];
  7665. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7666. "
  7667. @end example
  7668. @item
  7669. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7670. @example
  7671. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7672. -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]'
  7673. masked.avi
  7674. @end example
  7675. @item
  7676. Chain several overlays in cascade:
  7677. @example
  7678. nullsrc=s=200x200 [bg];
  7679. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7680. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7681. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7682. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7683. [in3] null, [mid2] overlay=100:100 [out0]
  7684. @end example
  7685. @end itemize
  7686. @section owdenoise
  7687. Apply Overcomplete Wavelet denoiser.
  7688. The filter accepts the following options:
  7689. @table @option
  7690. @item depth
  7691. Set depth.
  7692. Larger depth values will denoise lower frequency components more, but
  7693. slow down filtering.
  7694. Must be an int in the range 8-16, default is @code{8}.
  7695. @item luma_strength, ls
  7696. Set luma strength.
  7697. Must be a double value in the range 0-1000, default is @code{1.0}.
  7698. @item chroma_strength, cs
  7699. Set chroma strength.
  7700. Must be a double value in the range 0-1000, default is @code{1.0}.
  7701. @end table
  7702. @anchor{pad}
  7703. @section pad
  7704. Add paddings to the input image, and place the original input at the
  7705. provided @var{x}, @var{y} coordinates.
  7706. It accepts the following parameters:
  7707. @table @option
  7708. @item width, w
  7709. @item height, h
  7710. Specify an expression for the size of the output image with the
  7711. paddings added. If the value for @var{width} or @var{height} is 0, the
  7712. corresponding input size is used for the output.
  7713. The @var{width} expression can reference the value set by the
  7714. @var{height} expression, and vice versa.
  7715. The default value of @var{width} and @var{height} is 0.
  7716. @item x
  7717. @item y
  7718. Specify the offsets to place the input image at within the padded area,
  7719. with respect to the top/left border of the output image.
  7720. The @var{x} expression can reference the value set by the @var{y}
  7721. expression, and vice versa.
  7722. The default value of @var{x} and @var{y} is 0.
  7723. @item color
  7724. Specify the color of the padded area. For the syntax of this option,
  7725. check the "Color" section in the ffmpeg-utils manual.
  7726. The default value of @var{color} is "black".
  7727. @end table
  7728. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7729. options are expressions containing the following constants:
  7730. @table @option
  7731. @item in_w
  7732. @item in_h
  7733. The input video width and height.
  7734. @item iw
  7735. @item ih
  7736. These are the same as @var{in_w} and @var{in_h}.
  7737. @item out_w
  7738. @item out_h
  7739. The output width and height (the size of the padded area), as
  7740. specified by the @var{width} and @var{height} expressions.
  7741. @item ow
  7742. @item oh
  7743. These are the same as @var{out_w} and @var{out_h}.
  7744. @item x
  7745. @item y
  7746. The x and y offsets as specified by the @var{x} and @var{y}
  7747. expressions, or NAN if not yet specified.
  7748. @item a
  7749. same as @var{iw} / @var{ih}
  7750. @item sar
  7751. input sample aspect ratio
  7752. @item dar
  7753. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7754. @item hsub
  7755. @item vsub
  7756. The horizontal and vertical chroma subsample values. For example for the
  7757. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7758. @end table
  7759. @subsection Examples
  7760. @itemize
  7761. @item
  7762. Add paddings with the color "violet" to the input video. The output video
  7763. size is 640x480, and the top-left corner of the input video is placed at
  7764. column 0, row 40
  7765. @example
  7766. pad=640:480:0:40:violet
  7767. @end example
  7768. The example above is equivalent to the following command:
  7769. @example
  7770. pad=width=640:height=480:x=0:y=40:color=violet
  7771. @end example
  7772. @item
  7773. Pad the input to get an output with dimensions increased by 3/2,
  7774. and put the input video at the center of the padded area:
  7775. @example
  7776. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7777. @end example
  7778. @item
  7779. Pad the input to get a squared output with size equal to the maximum
  7780. value between the input width and height, and put the input video at
  7781. the center of the padded area:
  7782. @example
  7783. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7784. @end example
  7785. @item
  7786. Pad the input to get a final w/h ratio of 16:9:
  7787. @example
  7788. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7789. @end example
  7790. @item
  7791. In case of anamorphic video, in order to set the output display aspect
  7792. correctly, it is necessary to use @var{sar} in the expression,
  7793. according to the relation:
  7794. @example
  7795. (ih * X / ih) * sar = output_dar
  7796. X = output_dar / sar
  7797. @end example
  7798. Thus the previous example needs to be modified to:
  7799. @example
  7800. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7801. @end example
  7802. @item
  7803. Double the output size and put the input video in the bottom-right
  7804. corner of the output padded area:
  7805. @example
  7806. pad="2*iw:2*ih:ow-iw:oh-ih"
  7807. @end example
  7808. @end itemize
  7809. @anchor{palettegen}
  7810. @section palettegen
  7811. Generate one palette for a whole video stream.
  7812. It accepts the following options:
  7813. @table @option
  7814. @item max_colors
  7815. Set the maximum number of colors to quantize in the palette.
  7816. Note: the palette will still contain 256 colors; the unused palette entries
  7817. will be black.
  7818. @item reserve_transparent
  7819. Create a palette of 255 colors maximum and reserve the last one for
  7820. transparency. Reserving the transparency color is useful for GIF optimization.
  7821. If not set, the maximum of colors in the palette will be 256. You probably want
  7822. to disable this option for a standalone image.
  7823. Set by default.
  7824. @item stats_mode
  7825. Set statistics mode.
  7826. It accepts the following values:
  7827. @table @samp
  7828. @item full
  7829. Compute full frame histograms.
  7830. @item diff
  7831. Compute histograms only for the part that differs from previous frame. This
  7832. might be relevant to give more importance to the moving part of your input if
  7833. the background is static.
  7834. @end table
  7835. Default value is @var{full}.
  7836. @end table
  7837. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7838. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7839. color quantization of the palette. This information is also visible at
  7840. @var{info} logging level.
  7841. @subsection Examples
  7842. @itemize
  7843. @item
  7844. Generate a representative palette of a given video using @command{ffmpeg}:
  7845. @example
  7846. ffmpeg -i input.mkv -vf palettegen palette.png
  7847. @end example
  7848. @end itemize
  7849. @section paletteuse
  7850. Use a palette to downsample an input video stream.
  7851. The filter takes two inputs: one video stream and a palette. The palette must
  7852. be a 256 pixels image.
  7853. It accepts the following options:
  7854. @table @option
  7855. @item dither
  7856. Select dithering mode. Available algorithms are:
  7857. @table @samp
  7858. @item bayer
  7859. Ordered 8x8 bayer dithering (deterministic)
  7860. @item heckbert
  7861. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7862. Note: this dithering is sometimes considered "wrong" and is included as a
  7863. reference.
  7864. @item floyd_steinberg
  7865. Floyd and Steingberg dithering (error diffusion)
  7866. @item sierra2
  7867. Frankie Sierra dithering v2 (error diffusion)
  7868. @item sierra2_4a
  7869. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7870. @end table
  7871. Default is @var{sierra2_4a}.
  7872. @item bayer_scale
  7873. When @var{bayer} dithering is selected, this option defines the scale of the
  7874. pattern (how much the crosshatch pattern is visible). A low value means more
  7875. visible pattern for less banding, and higher value means less visible pattern
  7876. at the cost of more banding.
  7877. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7878. @item diff_mode
  7879. If set, define the zone to process
  7880. @table @samp
  7881. @item rectangle
  7882. Only the changing rectangle will be reprocessed. This is similar to GIF
  7883. cropping/offsetting compression mechanism. This option can be useful for speed
  7884. if only a part of the image is changing, and has use cases such as limiting the
  7885. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7886. moving scene (it leads to more deterministic output if the scene doesn't change
  7887. much, and as a result less moving noise and better GIF compression).
  7888. @end table
  7889. Default is @var{none}.
  7890. @end table
  7891. @subsection Examples
  7892. @itemize
  7893. @item
  7894. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7895. using @command{ffmpeg}:
  7896. @example
  7897. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7898. @end example
  7899. @end itemize
  7900. @section perspective
  7901. Correct perspective of video not recorded perpendicular to the screen.
  7902. A description of the accepted parameters follows.
  7903. @table @option
  7904. @item x0
  7905. @item y0
  7906. @item x1
  7907. @item y1
  7908. @item x2
  7909. @item y2
  7910. @item x3
  7911. @item y3
  7912. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7913. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7914. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7915. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7916. then the corners of the source will be sent to the specified coordinates.
  7917. The expressions can use the following variables:
  7918. @table @option
  7919. @item W
  7920. @item H
  7921. the width and height of video frame.
  7922. @item in
  7923. Input frame count.
  7924. @item on
  7925. Output frame count.
  7926. @end table
  7927. @item interpolation
  7928. Set interpolation for perspective correction.
  7929. It accepts the following values:
  7930. @table @samp
  7931. @item linear
  7932. @item cubic
  7933. @end table
  7934. Default value is @samp{linear}.
  7935. @item sense
  7936. Set interpretation of coordinate options.
  7937. It accepts the following values:
  7938. @table @samp
  7939. @item 0, source
  7940. Send point in the source specified by the given coordinates to
  7941. the corners of the destination.
  7942. @item 1, destination
  7943. Send the corners of the source to the point in the destination specified
  7944. by the given coordinates.
  7945. Default value is @samp{source}.
  7946. @end table
  7947. @item eval
  7948. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  7949. It accepts the following values:
  7950. @table @samp
  7951. @item init
  7952. only evaluate expressions once during the filter initialization or
  7953. when a command is processed
  7954. @item frame
  7955. evaluate expressions for each incoming frame
  7956. @end table
  7957. Default value is @samp{init}.
  7958. @end table
  7959. @section phase
  7960. Delay interlaced video by one field time so that the field order changes.
  7961. The intended use is to fix PAL movies that have been captured with the
  7962. opposite field order to the film-to-video transfer.
  7963. A description of the accepted parameters follows.
  7964. @table @option
  7965. @item mode
  7966. Set phase mode.
  7967. It accepts the following values:
  7968. @table @samp
  7969. @item t
  7970. Capture field order top-first, transfer bottom-first.
  7971. Filter will delay the bottom field.
  7972. @item b
  7973. Capture field order bottom-first, transfer top-first.
  7974. Filter will delay the top field.
  7975. @item p
  7976. Capture and transfer with the same field order. This mode only exists
  7977. for the documentation of the other options to refer to, but if you
  7978. actually select it, the filter will faithfully do nothing.
  7979. @item a
  7980. Capture field order determined automatically by field flags, transfer
  7981. opposite.
  7982. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7983. basis using field flags. If no field information is available,
  7984. then this works just like @samp{u}.
  7985. @item u
  7986. Capture unknown or varying, transfer opposite.
  7987. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7988. analyzing the images and selecting the alternative that produces best
  7989. match between the fields.
  7990. @item T
  7991. Capture top-first, transfer unknown or varying.
  7992. Filter selects among @samp{t} and @samp{p} using image analysis.
  7993. @item B
  7994. Capture bottom-first, transfer unknown or varying.
  7995. Filter selects among @samp{b} and @samp{p} using image analysis.
  7996. @item A
  7997. Capture determined by field flags, transfer unknown or varying.
  7998. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7999. image analysis. If no field information is available, then this works just
  8000. like @samp{U}. This is the default mode.
  8001. @item U
  8002. Both capture and transfer unknown or varying.
  8003. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8004. @end table
  8005. @end table
  8006. @section pixdesctest
  8007. Pixel format descriptor test filter, mainly useful for internal
  8008. testing. The output video should be equal to the input video.
  8009. For example:
  8010. @example
  8011. format=monow, pixdesctest
  8012. @end example
  8013. can be used to test the monowhite pixel format descriptor definition.
  8014. @section pp
  8015. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8016. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8017. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8018. Each subfilter and some options have a short and a long name that can be used
  8019. interchangeably, i.e. dr/dering are the same.
  8020. The filters accept the following options:
  8021. @table @option
  8022. @item subfilters
  8023. Set postprocessing subfilters string.
  8024. @end table
  8025. All subfilters share common options to determine their scope:
  8026. @table @option
  8027. @item a/autoq
  8028. Honor the quality commands for this subfilter.
  8029. @item c/chrom
  8030. Do chrominance filtering, too (default).
  8031. @item y/nochrom
  8032. Do luminance filtering only (no chrominance).
  8033. @item n/noluma
  8034. Do chrominance filtering only (no luminance).
  8035. @end table
  8036. These options can be appended after the subfilter name, separated by a '|'.
  8037. Available subfilters are:
  8038. @table @option
  8039. @item hb/hdeblock[|difference[|flatness]]
  8040. Horizontal deblocking filter
  8041. @table @option
  8042. @item difference
  8043. Difference factor where higher values mean more deblocking (default: @code{32}).
  8044. @item flatness
  8045. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8046. @end table
  8047. @item vb/vdeblock[|difference[|flatness]]
  8048. Vertical deblocking filter
  8049. @table @option
  8050. @item difference
  8051. Difference factor where higher values mean more deblocking (default: @code{32}).
  8052. @item flatness
  8053. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8054. @end table
  8055. @item ha/hadeblock[|difference[|flatness]]
  8056. Accurate horizontal deblocking filter
  8057. @table @option
  8058. @item difference
  8059. Difference factor where higher values mean more deblocking (default: @code{32}).
  8060. @item flatness
  8061. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8062. @end table
  8063. @item va/vadeblock[|difference[|flatness]]
  8064. Accurate vertical deblocking filter
  8065. @table @option
  8066. @item difference
  8067. Difference factor where higher values mean more deblocking (default: @code{32}).
  8068. @item flatness
  8069. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8070. @end table
  8071. @end table
  8072. The horizontal and vertical deblocking filters share the difference and
  8073. flatness values so you cannot set different horizontal and vertical
  8074. thresholds.
  8075. @table @option
  8076. @item h1/x1hdeblock
  8077. Experimental horizontal deblocking filter
  8078. @item v1/x1vdeblock
  8079. Experimental vertical deblocking filter
  8080. @item dr/dering
  8081. Deringing filter
  8082. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8083. @table @option
  8084. @item threshold1
  8085. larger -> stronger filtering
  8086. @item threshold2
  8087. larger -> stronger filtering
  8088. @item threshold3
  8089. larger -> stronger filtering
  8090. @end table
  8091. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8092. @table @option
  8093. @item f/fullyrange
  8094. Stretch luminance to @code{0-255}.
  8095. @end table
  8096. @item lb/linblenddeint
  8097. Linear blend deinterlacing filter that deinterlaces the given block by
  8098. filtering all lines with a @code{(1 2 1)} filter.
  8099. @item li/linipoldeint
  8100. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8101. linearly interpolating every second line.
  8102. @item ci/cubicipoldeint
  8103. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8104. cubically interpolating every second line.
  8105. @item md/mediandeint
  8106. Median deinterlacing filter that deinterlaces the given block by applying a
  8107. median filter to every second line.
  8108. @item fd/ffmpegdeint
  8109. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8110. second line with a @code{(-1 4 2 4 -1)} filter.
  8111. @item l5/lowpass5
  8112. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8113. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8114. @item fq/forceQuant[|quantizer]
  8115. Overrides the quantizer table from the input with the constant quantizer you
  8116. specify.
  8117. @table @option
  8118. @item quantizer
  8119. Quantizer to use
  8120. @end table
  8121. @item de/default
  8122. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8123. @item fa/fast
  8124. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8125. @item ac
  8126. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8127. @end table
  8128. @subsection Examples
  8129. @itemize
  8130. @item
  8131. Apply horizontal and vertical deblocking, deringing and automatic
  8132. brightness/contrast:
  8133. @example
  8134. pp=hb/vb/dr/al
  8135. @end example
  8136. @item
  8137. Apply default filters without brightness/contrast correction:
  8138. @example
  8139. pp=de/-al
  8140. @end example
  8141. @item
  8142. Apply default filters and temporal denoiser:
  8143. @example
  8144. pp=default/tmpnoise|1|2|3
  8145. @end example
  8146. @item
  8147. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8148. automatically depending on available CPU time:
  8149. @example
  8150. pp=hb|y/vb|a
  8151. @end example
  8152. @end itemize
  8153. @section pp7
  8154. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8155. similar to spp = 6 with 7 point DCT, where only the center sample is
  8156. used after IDCT.
  8157. The filter accepts the following options:
  8158. @table @option
  8159. @item qp
  8160. Force a constant quantization parameter. It accepts an integer in range
  8161. 0 to 63. If not set, the filter will use the QP from the video stream
  8162. (if available).
  8163. @item mode
  8164. Set thresholding mode. Available modes are:
  8165. @table @samp
  8166. @item hard
  8167. Set hard thresholding.
  8168. @item soft
  8169. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8170. @item medium
  8171. Set medium thresholding (good results, default).
  8172. @end table
  8173. @end table
  8174. @section psnr
  8175. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8176. Ratio) between two input videos.
  8177. This filter takes in input two input videos, the first input is
  8178. considered the "main" source and is passed unchanged to the
  8179. output. The second input is used as a "reference" video for computing
  8180. the PSNR.
  8181. Both video inputs must have the same resolution and pixel format for
  8182. this filter to work correctly. Also it assumes that both inputs
  8183. have the same number of frames, which are compared one by one.
  8184. The obtained average PSNR is printed through the logging system.
  8185. The filter stores the accumulated MSE (mean squared error) of each
  8186. frame, and at the end of the processing it is averaged across all frames
  8187. equally, and the following formula is applied to obtain the PSNR:
  8188. @example
  8189. PSNR = 10*log10(MAX^2/MSE)
  8190. @end example
  8191. Where MAX is the average of the maximum values of each component of the
  8192. image.
  8193. The description of the accepted parameters follows.
  8194. @table @option
  8195. @item stats_file, f
  8196. If specified the filter will use the named file to save the PSNR of
  8197. each individual frame. When filename equals "-" the data is sent to
  8198. standard output.
  8199. @end table
  8200. The file printed if @var{stats_file} is selected, contains a sequence of
  8201. key/value pairs of the form @var{key}:@var{value} for each compared
  8202. couple of frames.
  8203. A description of each shown parameter follows:
  8204. @table @option
  8205. @item n
  8206. sequential number of the input frame, starting from 1
  8207. @item mse_avg
  8208. Mean Square Error pixel-by-pixel average difference of the compared
  8209. frames, averaged over all the image components.
  8210. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8211. Mean Square Error pixel-by-pixel average difference of the compared
  8212. frames for the component specified by the suffix.
  8213. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8214. Peak Signal to Noise ratio of the compared frames for the component
  8215. specified by the suffix.
  8216. @end table
  8217. For example:
  8218. @example
  8219. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8220. [main][ref] psnr="stats_file=stats.log" [out]
  8221. @end example
  8222. On this example the input file being processed is compared with the
  8223. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8224. is stored in @file{stats.log}.
  8225. @anchor{pullup}
  8226. @section pullup
  8227. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8228. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8229. content.
  8230. The pullup filter is designed to take advantage of future context in making
  8231. its decisions. This filter is stateless in the sense that it does not lock
  8232. onto a pattern to follow, but it instead looks forward to the following
  8233. fields in order to identify matches and rebuild progressive frames.
  8234. To produce content with an even framerate, insert the fps filter after
  8235. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8236. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8237. The filter accepts the following options:
  8238. @table @option
  8239. @item jl
  8240. @item jr
  8241. @item jt
  8242. @item jb
  8243. These options set the amount of "junk" to ignore at the left, right, top, and
  8244. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8245. while top and bottom are in units of 2 lines.
  8246. The default is 8 pixels on each side.
  8247. @item sb
  8248. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8249. filter generating an occasional mismatched frame, but it may also cause an
  8250. excessive number of frames to be dropped during high motion sequences.
  8251. Conversely, setting it to -1 will make filter match fields more easily.
  8252. This may help processing of video where there is slight blurring between
  8253. the fields, but may also cause there to be interlaced frames in the output.
  8254. Default value is @code{0}.
  8255. @item mp
  8256. Set the metric plane to use. It accepts the following values:
  8257. @table @samp
  8258. @item l
  8259. Use luma plane.
  8260. @item u
  8261. Use chroma blue plane.
  8262. @item v
  8263. Use chroma red plane.
  8264. @end table
  8265. This option may be set to use chroma plane instead of the default luma plane
  8266. for doing filter's computations. This may improve accuracy on very clean
  8267. source material, but more likely will decrease accuracy, especially if there
  8268. is chroma noise (rainbow effect) or any grayscale video.
  8269. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8270. load and make pullup usable in realtime on slow machines.
  8271. @end table
  8272. For best results (without duplicated frames in the output file) it is
  8273. necessary to change the output frame rate. For example, to inverse
  8274. telecine NTSC input:
  8275. @example
  8276. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8277. @end example
  8278. @section qp
  8279. Change video quantization parameters (QP).
  8280. The filter accepts the following option:
  8281. @table @option
  8282. @item qp
  8283. Set expression for quantization parameter.
  8284. @end table
  8285. The expression is evaluated through the eval API and can contain, among others,
  8286. the following constants:
  8287. @table @var
  8288. @item known
  8289. 1 if index is not 129, 0 otherwise.
  8290. @item qp
  8291. Sequentional index starting from -129 to 128.
  8292. @end table
  8293. @subsection Examples
  8294. @itemize
  8295. @item
  8296. Some equation like:
  8297. @example
  8298. qp=2+2*sin(PI*qp)
  8299. @end example
  8300. @end itemize
  8301. @section random
  8302. Flush video frames from internal cache of frames into a random order.
  8303. No frame is discarded.
  8304. Inspired by @ref{frei0r} nervous filter.
  8305. @table @option
  8306. @item frames
  8307. Set size in number of frames of internal cache, in range from @code{2} to
  8308. @code{512}. Default is @code{30}.
  8309. @item seed
  8310. Set seed for random number generator, must be an integer included between
  8311. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8312. less than @code{0}, the filter will try to use a good random seed on a
  8313. best effort basis.
  8314. @end table
  8315. @section readvitc
  8316. Read vertical interval timecode (VITC) information from the top lines of a
  8317. video frame.
  8318. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8319. timecode value, if a valid timecode has been detected. Further metadata key
  8320. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8321. timecode data has been found or not.
  8322. This filter accepts the following options:
  8323. @table @option
  8324. @item scan_max
  8325. Set the maximum number of lines to scan for VITC data. If the value is set to
  8326. @code{-1} the full video frame is scanned. Default is @code{45}.
  8327. @item thr_b
  8328. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8329. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8330. @item thr_w
  8331. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8332. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8333. @end table
  8334. @subsection Examples
  8335. @itemize
  8336. @item
  8337. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8338. draw @code{--:--:--:--} as a placeholder:
  8339. @example
  8340. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8341. @end example
  8342. @end itemize
  8343. @section remap
  8344. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8345. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8346. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8347. value for pixel will be used for destination pixel.
  8348. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8349. will have Xmap/Ymap video stream dimensions.
  8350. Xmap and Ymap input video streams are 16bit depth, single channel.
  8351. @section removegrain
  8352. The removegrain filter is a spatial denoiser for progressive video.
  8353. @table @option
  8354. @item m0
  8355. Set mode for the first plane.
  8356. @item m1
  8357. Set mode for the second plane.
  8358. @item m2
  8359. Set mode for the third plane.
  8360. @item m3
  8361. Set mode for the fourth plane.
  8362. @end table
  8363. Range of mode is from 0 to 24. Description of each mode follows:
  8364. @table @var
  8365. @item 0
  8366. Leave input plane unchanged. Default.
  8367. @item 1
  8368. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8369. @item 2
  8370. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8371. @item 3
  8372. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8373. @item 4
  8374. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8375. This is equivalent to a median filter.
  8376. @item 5
  8377. Line-sensitive clipping giving the minimal change.
  8378. @item 6
  8379. Line-sensitive clipping, intermediate.
  8380. @item 7
  8381. Line-sensitive clipping, intermediate.
  8382. @item 8
  8383. Line-sensitive clipping, intermediate.
  8384. @item 9
  8385. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8386. @item 10
  8387. Replaces the target pixel with the closest neighbour.
  8388. @item 11
  8389. [1 2 1] horizontal and vertical kernel blur.
  8390. @item 12
  8391. Same as mode 11.
  8392. @item 13
  8393. Bob mode, interpolates top field from the line where the neighbours
  8394. pixels are the closest.
  8395. @item 14
  8396. Bob mode, interpolates bottom field from the line where the neighbours
  8397. pixels are the closest.
  8398. @item 15
  8399. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8400. interpolation formula.
  8401. @item 16
  8402. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8403. interpolation formula.
  8404. @item 17
  8405. Clips the pixel with the minimum and maximum of respectively the maximum and
  8406. minimum of each pair of opposite neighbour pixels.
  8407. @item 18
  8408. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8409. the current pixel is minimal.
  8410. @item 19
  8411. Replaces the pixel with the average of its 8 neighbours.
  8412. @item 20
  8413. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8414. @item 21
  8415. Clips pixels using the averages of opposite neighbour.
  8416. @item 22
  8417. Same as mode 21 but simpler and faster.
  8418. @item 23
  8419. Small edge and halo removal, but reputed useless.
  8420. @item 24
  8421. Similar as 23.
  8422. @end table
  8423. @section removelogo
  8424. Suppress a TV station logo, using an image file to determine which
  8425. pixels comprise the logo. It works by filling in the pixels that
  8426. comprise the logo with neighboring pixels.
  8427. The filter accepts the following options:
  8428. @table @option
  8429. @item filename, f
  8430. Set the filter bitmap file, which can be any image format supported by
  8431. libavformat. The width and height of the image file must match those of the
  8432. video stream being processed.
  8433. @end table
  8434. Pixels in the provided bitmap image with a value of zero are not
  8435. considered part of the logo, non-zero pixels are considered part of
  8436. the logo. If you use white (255) for the logo and black (0) for the
  8437. rest, you will be safe. For making the filter bitmap, it is
  8438. recommended to take a screen capture of a black frame with the logo
  8439. visible, and then using a threshold filter followed by the erode
  8440. filter once or twice.
  8441. If needed, little splotches can be fixed manually. Remember that if
  8442. logo pixels are not covered, the filter quality will be much
  8443. reduced. Marking too many pixels as part of the logo does not hurt as
  8444. much, but it will increase the amount of blurring needed to cover over
  8445. the image and will destroy more information than necessary, and extra
  8446. pixels will slow things down on a large logo.
  8447. @section repeatfields
  8448. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8449. fields based on its value.
  8450. @section reverse, areverse
  8451. Reverse a clip.
  8452. Warning: This filter requires memory to buffer the entire clip, so trimming
  8453. is suggested.
  8454. @subsection Examples
  8455. @itemize
  8456. @item
  8457. Take the first 5 seconds of a clip, and reverse it.
  8458. @example
  8459. trim=end=5,reverse
  8460. @end example
  8461. @end itemize
  8462. @section rotate
  8463. Rotate video by an arbitrary angle expressed in radians.
  8464. The filter accepts the following options:
  8465. A description of the optional parameters follows.
  8466. @table @option
  8467. @item angle, a
  8468. Set an expression for the angle by which to rotate the input video
  8469. clockwise, expressed as a number of radians. A negative value will
  8470. result in a counter-clockwise rotation. By default it is set to "0".
  8471. This expression is evaluated for each frame.
  8472. @item out_w, ow
  8473. Set the output width expression, default value is "iw".
  8474. This expression is evaluated just once during configuration.
  8475. @item out_h, oh
  8476. Set the output height expression, default value is "ih".
  8477. This expression is evaluated just once during configuration.
  8478. @item bilinear
  8479. Enable bilinear interpolation if set to 1, a value of 0 disables
  8480. it. Default value is 1.
  8481. @item fillcolor, c
  8482. Set the color used to fill the output area not covered by the rotated
  8483. image. For the general syntax of this option, check the "Color" section in the
  8484. ffmpeg-utils manual. If the special value "none" is selected then no
  8485. background is printed (useful for example if the background is never shown).
  8486. Default value is "black".
  8487. @end table
  8488. The expressions for the angle and the output size can contain the
  8489. following constants and functions:
  8490. @table @option
  8491. @item n
  8492. sequential number of the input frame, starting from 0. It is always NAN
  8493. before the first frame is filtered.
  8494. @item t
  8495. time in seconds of the input frame, it is set to 0 when the filter is
  8496. configured. It is always NAN before the first frame is filtered.
  8497. @item hsub
  8498. @item vsub
  8499. horizontal and vertical chroma subsample values. For example for the
  8500. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8501. @item in_w, iw
  8502. @item in_h, ih
  8503. the input video width and height
  8504. @item out_w, ow
  8505. @item out_h, oh
  8506. the output width and height, that is the size of the padded area as
  8507. specified by the @var{width} and @var{height} expressions
  8508. @item rotw(a)
  8509. @item roth(a)
  8510. the minimal width/height required for completely containing the input
  8511. video rotated by @var{a} radians.
  8512. These are only available when computing the @option{out_w} and
  8513. @option{out_h} expressions.
  8514. @end table
  8515. @subsection Examples
  8516. @itemize
  8517. @item
  8518. Rotate the input by PI/6 radians clockwise:
  8519. @example
  8520. rotate=PI/6
  8521. @end example
  8522. @item
  8523. Rotate the input by PI/6 radians counter-clockwise:
  8524. @example
  8525. rotate=-PI/6
  8526. @end example
  8527. @item
  8528. Rotate the input by 45 degrees clockwise:
  8529. @example
  8530. rotate=45*PI/180
  8531. @end example
  8532. @item
  8533. Apply a constant rotation with period T, starting from an angle of PI/3:
  8534. @example
  8535. rotate=PI/3+2*PI*t/T
  8536. @end example
  8537. @item
  8538. Make the input video rotation oscillating with a period of T
  8539. seconds and an amplitude of A radians:
  8540. @example
  8541. rotate=A*sin(2*PI/T*t)
  8542. @end example
  8543. @item
  8544. Rotate the video, output size is chosen so that the whole rotating
  8545. input video is always completely contained in the output:
  8546. @example
  8547. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8548. @end example
  8549. @item
  8550. Rotate the video, reduce the output size so that no background is ever
  8551. shown:
  8552. @example
  8553. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8554. @end example
  8555. @end itemize
  8556. @subsection Commands
  8557. The filter supports the following commands:
  8558. @table @option
  8559. @item a, angle
  8560. Set the angle expression.
  8561. The command accepts the same syntax of the corresponding option.
  8562. If the specified expression is not valid, it is kept at its current
  8563. value.
  8564. @end table
  8565. @section sab
  8566. Apply Shape Adaptive Blur.
  8567. The filter accepts the following options:
  8568. @table @option
  8569. @item luma_radius, lr
  8570. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8571. value is 1.0. A greater value will result in a more blurred image, and
  8572. in slower processing.
  8573. @item luma_pre_filter_radius, lpfr
  8574. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8575. value is 1.0.
  8576. @item luma_strength, ls
  8577. Set luma maximum difference between pixels to still be considered, must
  8578. be a value in the 0.1-100.0 range, default value is 1.0.
  8579. @item chroma_radius, cr
  8580. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  8581. greater value will result in a more blurred image, and in slower
  8582. processing.
  8583. @item chroma_pre_filter_radius, cpfr
  8584. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  8585. @item chroma_strength, cs
  8586. Set chroma maximum difference between pixels to still be considered,
  8587. must be a value in the 0.1-100.0 range.
  8588. @end table
  8589. Each chroma option value, if not explicitly specified, is set to the
  8590. corresponding luma option value.
  8591. @anchor{scale}
  8592. @section scale
  8593. Scale (resize) the input video, using the libswscale library.
  8594. The scale filter forces the output display aspect ratio to be the same
  8595. of the input, by changing the output sample aspect ratio.
  8596. If the input image format is different from the format requested by
  8597. the next filter, the scale filter will convert the input to the
  8598. requested format.
  8599. @subsection Options
  8600. The filter accepts the following options, or any of the options
  8601. supported by the libswscale scaler.
  8602. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8603. the complete list of scaler options.
  8604. @table @option
  8605. @item width, w
  8606. @item height, h
  8607. Set the output video dimension expression. Default value is the input
  8608. dimension.
  8609. If the value is 0, the input width is used for the output.
  8610. If one of the values is -1, the scale filter will use a value that
  8611. maintains the aspect ratio of the input image, calculated from the
  8612. other specified dimension. If both of them are -1, the input size is
  8613. used
  8614. If one of the values is -n with n > 1, the scale filter will also use a value
  8615. that maintains the aspect ratio of the input image, calculated from the other
  8616. specified dimension. After that it will, however, make sure that the calculated
  8617. dimension is divisible by n and adjust the value if necessary.
  8618. See below for the list of accepted constants for use in the dimension
  8619. expression.
  8620. @item eval
  8621. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8622. @table @samp
  8623. @item init
  8624. Only evaluate expressions once during the filter initialization or when a command is processed.
  8625. @item frame
  8626. Evaluate expressions for each incoming frame.
  8627. @end table
  8628. Default value is @samp{init}.
  8629. @item interl
  8630. Set the interlacing mode. It accepts the following values:
  8631. @table @samp
  8632. @item 1
  8633. Force interlaced aware scaling.
  8634. @item 0
  8635. Do not apply interlaced scaling.
  8636. @item -1
  8637. Select interlaced aware scaling depending on whether the source frames
  8638. are flagged as interlaced or not.
  8639. @end table
  8640. Default value is @samp{0}.
  8641. @item flags
  8642. Set libswscale scaling flags. See
  8643. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8644. complete list of values. If not explicitly specified the filter applies
  8645. the default flags.
  8646. @item param0, param1
  8647. Set libswscale input parameters for scaling algorithms that need them. See
  8648. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8649. complete documentation. If not explicitly specified the filter applies
  8650. empty parameters.
  8651. @item size, s
  8652. Set the video size. For the syntax of this option, check the
  8653. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8654. @item in_color_matrix
  8655. @item out_color_matrix
  8656. Set in/output YCbCr color space type.
  8657. This allows the autodetected value to be overridden as well as allows forcing
  8658. a specific value used for the output and encoder.
  8659. If not specified, the color space type depends on the pixel format.
  8660. Possible values:
  8661. @table @samp
  8662. @item auto
  8663. Choose automatically.
  8664. @item bt709
  8665. Format conforming to International Telecommunication Union (ITU)
  8666. Recommendation BT.709.
  8667. @item fcc
  8668. Set color space conforming to the United States Federal Communications
  8669. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8670. @item bt601
  8671. Set color space conforming to:
  8672. @itemize
  8673. @item
  8674. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8675. @item
  8676. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8677. @item
  8678. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8679. @end itemize
  8680. @item smpte240m
  8681. Set color space conforming to SMPTE ST 240:1999.
  8682. @end table
  8683. @item in_range
  8684. @item out_range
  8685. Set in/output YCbCr sample range.
  8686. This allows the autodetected value to be overridden as well as allows forcing
  8687. a specific value used for the output and encoder. If not specified, the
  8688. range depends on the pixel format. Possible values:
  8689. @table @samp
  8690. @item auto
  8691. Choose automatically.
  8692. @item jpeg/full/pc
  8693. Set full range (0-255 in case of 8-bit luma).
  8694. @item mpeg/tv
  8695. Set "MPEG" range (16-235 in case of 8-bit luma).
  8696. @end table
  8697. @item force_original_aspect_ratio
  8698. Enable decreasing or increasing output video width or height if necessary to
  8699. keep the original aspect ratio. Possible values:
  8700. @table @samp
  8701. @item disable
  8702. Scale the video as specified and disable this feature.
  8703. @item decrease
  8704. The output video dimensions will automatically be decreased if needed.
  8705. @item increase
  8706. The output video dimensions will automatically be increased if needed.
  8707. @end table
  8708. One useful instance of this option is that when you know a specific device's
  8709. maximum allowed resolution, you can use this to limit the output video to
  8710. that, while retaining the aspect ratio. For example, device A allows
  8711. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8712. decrease) and specifying 1280x720 to the command line makes the output
  8713. 1280x533.
  8714. Please note that this is a different thing than specifying -1 for @option{w}
  8715. or @option{h}, you still need to specify the output resolution for this option
  8716. to work.
  8717. @end table
  8718. The values of the @option{w} and @option{h} options are expressions
  8719. containing the following constants:
  8720. @table @var
  8721. @item in_w
  8722. @item in_h
  8723. The input width and height
  8724. @item iw
  8725. @item ih
  8726. These are the same as @var{in_w} and @var{in_h}.
  8727. @item out_w
  8728. @item out_h
  8729. The output (scaled) width and height
  8730. @item ow
  8731. @item oh
  8732. These are the same as @var{out_w} and @var{out_h}
  8733. @item a
  8734. The same as @var{iw} / @var{ih}
  8735. @item sar
  8736. input sample aspect ratio
  8737. @item dar
  8738. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8739. @item hsub
  8740. @item vsub
  8741. horizontal and vertical input chroma subsample values. For example for the
  8742. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8743. @item ohsub
  8744. @item ovsub
  8745. horizontal and vertical output chroma subsample values. For example for the
  8746. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8747. @end table
  8748. @subsection Examples
  8749. @itemize
  8750. @item
  8751. Scale the input video to a size of 200x100
  8752. @example
  8753. scale=w=200:h=100
  8754. @end example
  8755. This is equivalent to:
  8756. @example
  8757. scale=200:100
  8758. @end example
  8759. or:
  8760. @example
  8761. scale=200x100
  8762. @end example
  8763. @item
  8764. Specify a size abbreviation for the output size:
  8765. @example
  8766. scale=qcif
  8767. @end example
  8768. which can also be written as:
  8769. @example
  8770. scale=size=qcif
  8771. @end example
  8772. @item
  8773. Scale the input to 2x:
  8774. @example
  8775. scale=w=2*iw:h=2*ih
  8776. @end example
  8777. @item
  8778. The above is the same as:
  8779. @example
  8780. scale=2*in_w:2*in_h
  8781. @end example
  8782. @item
  8783. Scale the input to 2x with forced interlaced scaling:
  8784. @example
  8785. scale=2*iw:2*ih:interl=1
  8786. @end example
  8787. @item
  8788. Scale the input to half size:
  8789. @example
  8790. scale=w=iw/2:h=ih/2
  8791. @end example
  8792. @item
  8793. Increase the width, and set the height to the same size:
  8794. @example
  8795. scale=3/2*iw:ow
  8796. @end example
  8797. @item
  8798. Seek Greek harmony:
  8799. @example
  8800. scale=iw:1/PHI*iw
  8801. scale=ih*PHI:ih
  8802. @end example
  8803. @item
  8804. Increase the height, and set the width to 3/2 of the height:
  8805. @example
  8806. scale=w=3/2*oh:h=3/5*ih
  8807. @end example
  8808. @item
  8809. Increase the size, making the size a multiple of the chroma
  8810. subsample values:
  8811. @example
  8812. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8813. @end example
  8814. @item
  8815. Increase the width to a maximum of 500 pixels,
  8816. keeping the same aspect ratio as the input:
  8817. @example
  8818. scale=w='min(500\, iw*3/2):h=-1'
  8819. @end example
  8820. @end itemize
  8821. @subsection Commands
  8822. This filter supports the following commands:
  8823. @table @option
  8824. @item width, w
  8825. @item height, h
  8826. Set the output video dimension expression.
  8827. The command accepts the same syntax of the corresponding option.
  8828. If the specified expression is not valid, it is kept at its current
  8829. value.
  8830. @end table
  8831. @section scale2ref
  8832. Scale (resize) the input video, based on a reference video.
  8833. See the scale filter for available options, scale2ref supports the same but
  8834. uses the reference video instead of the main input as basis.
  8835. @subsection Examples
  8836. @itemize
  8837. @item
  8838. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  8839. @example
  8840. 'scale2ref[b][a];[a][b]overlay'
  8841. @end example
  8842. @end itemize
  8843. @anchor{selectivecolor}
  8844. @section selectivecolor
  8845. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8846. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8847. by the "purity" of the color (that is, how saturated it already is).
  8848. This filter is similar to the Adobe Photoshop Selective Color tool.
  8849. The filter accepts the following options:
  8850. @table @option
  8851. @item correction_method
  8852. Select color correction method.
  8853. Available values are:
  8854. @table @samp
  8855. @item absolute
  8856. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8857. component value).
  8858. @item relative
  8859. Specified adjustments are relative to the original component value.
  8860. @end table
  8861. Default is @code{absolute}.
  8862. @item reds
  8863. Adjustments for red pixels (pixels where the red component is the maximum)
  8864. @item yellows
  8865. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8866. @item greens
  8867. Adjustments for green pixels (pixels where the green component is the maximum)
  8868. @item cyans
  8869. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8870. @item blues
  8871. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8872. @item magentas
  8873. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8874. @item whites
  8875. Adjustments for white pixels (pixels where all components are greater than 128)
  8876. @item neutrals
  8877. Adjustments for all pixels except pure black and pure white
  8878. @item blacks
  8879. Adjustments for black pixels (pixels where all components are lesser than 128)
  8880. @item psfile
  8881. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8882. @end table
  8883. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8884. 4 space separated floating point adjustment values in the [-1,1] range,
  8885. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8886. pixels of its range.
  8887. @subsection Examples
  8888. @itemize
  8889. @item
  8890. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8891. increase magenta by 27% in blue areas:
  8892. @example
  8893. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8894. @end example
  8895. @item
  8896. Use a Photoshop selective color preset:
  8897. @example
  8898. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8899. @end example
  8900. @end itemize
  8901. @section separatefields
  8902. The @code{separatefields} takes a frame-based video input and splits
  8903. each frame into its components fields, producing a new half height clip
  8904. with twice the frame rate and twice the frame count.
  8905. This filter use field-dominance information in frame to decide which
  8906. of each pair of fields to place first in the output.
  8907. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8908. @section setdar, setsar
  8909. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8910. output video.
  8911. This is done by changing the specified Sample (aka Pixel) Aspect
  8912. Ratio, according to the following equation:
  8913. @example
  8914. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8915. @end example
  8916. Keep in mind that the @code{setdar} filter does not modify the pixel
  8917. dimensions of the video frame. Also, the display aspect ratio set by
  8918. this filter may be changed by later filters in the filterchain,
  8919. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8920. applied.
  8921. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8922. the filter output video.
  8923. Note that as a consequence of the application of this filter, the
  8924. output display aspect ratio will change according to the equation
  8925. above.
  8926. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8927. filter may be changed by later filters in the filterchain, e.g. if
  8928. another "setsar" or a "setdar" filter is applied.
  8929. It accepts the following parameters:
  8930. @table @option
  8931. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8932. Set the aspect ratio used by the filter.
  8933. The parameter can be a floating point number string, an expression, or
  8934. a string of the form @var{num}:@var{den}, where @var{num} and
  8935. @var{den} are the numerator and denominator of the aspect ratio. If
  8936. the parameter is not specified, it is assumed the value "0".
  8937. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8938. should be escaped.
  8939. @item max
  8940. Set the maximum integer value to use for expressing numerator and
  8941. denominator when reducing the expressed aspect ratio to a rational.
  8942. Default value is @code{100}.
  8943. @end table
  8944. The parameter @var{sar} is an expression containing
  8945. the following constants:
  8946. @table @option
  8947. @item E, PI, PHI
  8948. These are approximated values for the mathematical constants e
  8949. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8950. @item w, h
  8951. The input width and height.
  8952. @item a
  8953. These are the same as @var{w} / @var{h}.
  8954. @item sar
  8955. The input sample aspect ratio.
  8956. @item dar
  8957. The input display aspect ratio. It is the same as
  8958. (@var{w} / @var{h}) * @var{sar}.
  8959. @item hsub, vsub
  8960. Horizontal and vertical chroma subsample values. For example, for the
  8961. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8962. @end table
  8963. @subsection Examples
  8964. @itemize
  8965. @item
  8966. To change the display aspect ratio to 16:9, specify one of the following:
  8967. @example
  8968. setdar=dar=1.77777
  8969. setdar=dar=16/9
  8970. @end example
  8971. @item
  8972. To change the sample aspect ratio to 10:11, specify:
  8973. @example
  8974. setsar=sar=10/11
  8975. @end example
  8976. @item
  8977. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8978. 1000 in the aspect ratio reduction, use the command:
  8979. @example
  8980. setdar=ratio=16/9:max=1000
  8981. @end example
  8982. @end itemize
  8983. @anchor{setfield}
  8984. @section setfield
  8985. Force field for the output video frame.
  8986. The @code{setfield} filter marks the interlace type field for the
  8987. output frames. It does not change the input frame, but only sets the
  8988. corresponding property, which affects how the frame is treated by
  8989. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8990. The filter accepts the following options:
  8991. @table @option
  8992. @item mode
  8993. Available values are:
  8994. @table @samp
  8995. @item auto
  8996. Keep the same field property.
  8997. @item bff
  8998. Mark the frame as bottom-field-first.
  8999. @item tff
  9000. Mark the frame as top-field-first.
  9001. @item prog
  9002. Mark the frame as progressive.
  9003. @end table
  9004. @end table
  9005. @section showinfo
  9006. Show a line containing various information for each input video frame.
  9007. The input video is not modified.
  9008. The shown line contains a sequence of key/value pairs of the form
  9009. @var{key}:@var{value}.
  9010. The following values are shown in the output:
  9011. @table @option
  9012. @item n
  9013. The (sequential) number of the input frame, starting from 0.
  9014. @item pts
  9015. The Presentation TimeStamp of the input frame, expressed as a number of
  9016. time base units. The time base unit depends on the filter input pad.
  9017. @item pts_time
  9018. The Presentation TimeStamp of the input frame, expressed as a number of
  9019. seconds.
  9020. @item pos
  9021. The position of the frame in the input stream, or -1 if this information is
  9022. unavailable and/or meaningless (for example in case of synthetic video).
  9023. @item fmt
  9024. The pixel format name.
  9025. @item sar
  9026. The sample aspect ratio of the input frame, expressed in the form
  9027. @var{num}/@var{den}.
  9028. @item s
  9029. The size of the input frame. For the syntax of this option, check the
  9030. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9031. @item i
  9032. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9033. for bottom field first).
  9034. @item iskey
  9035. This is 1 if the frame is a key frame, 0 otherwise.
  9036. @item type
  9037. The picture type of the input frame ("I" for an I-frame, "P" for a
  9038. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9039. Also refer to the documentation of the @code{AVPictureType} enum and of
  9040. the @code{av_get_picture_type_char} function defined in
  9041. @file{libavutil/avutil.h}.
  9042. @item checksum
  9043. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9044. @item plane_checksum
  9045. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9046. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9047. @end table
  9048. @section showpalette
  9049. Displays the 256 colors palette of each frame. This filter is only relevant for
  9050. @var{pal8} pixel format frames.
  9051. It accepts the following option:
  9052. @table @option
  9053. @item s
  9054. Set the size of the box used to represent one palette color entry. Default is
  9055. @code{30} (for a @code{30x30} pixel box).
  9056. @end table
  9057. @section shuffleframes
  9058. Reorder and/or duplicate video frames.
  9059. It accepts the following parameters:
  9060. @table @option
  9061. @item mapping
  9062. Set the destination indexes of input frames.
  9063. This is space or '|' separated list of indexes that maps input frames to output
  9064. frames. Number of indexes also sets maximal value that each index may have.
  9065. @end table
  9066. The first frame has the index 0. The default is to keep the input unchanged.
  9067. Swap second and third frame of every three frames of the input:
  9068. @example
  9069. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9070. @end example
  9071. @section shuffleplanes
  9072. Reorder and/or duplicate video planes.
  9073. It accepts the following parameters:
  9074. @table @option
  9075. @item map0
  9076. The index of the input plane to be used as the first output plane.
  9077. @item map1
  9078. The index of the input plane to be used as the second output plane.
  9079. @item map2
  9080. The index of the input plane to be used as the third output plane.
  9081. @item map3
  9082. The index of the input plane to be used as the fourth output plane.
  9083. @end table
  9084. The first plane has the index 0. The default is to keep the input unchanged.
  9085. Swap the second and third planes of the input:
  9086. @example
  9087. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9088. @end example
  9089. @anchor{signalstats}
  9090. @section signalstats
  9091. Evaluate various visual metrics that assist in determining issues associated
  9092. with the digitization of analog video media.
  9093. By default the filter will log these metadata values:
  9094. @table @option
  9095. @item YMIN
  9096. Display the minimal Y value contained within the input frame. Expressed in
  9097. range of [0-255].
  9098. @item YLOW
  9099. Display the Y value at the 10% percentile within the input frame. Expressed in
  9100. range of [0-255].
  9101. @item YAVG
  9102. Display the average Y value within the input frame. Expressed in range of
  9103. [0-255].
  9104. @item YHIGH
  9105. Display the Y value at the 90% percentile within the input frame. Expressed in
  9106. range of [0-255].
  9107. @item YMAX
  9108. Display the maximum Y value contained within the input frame. Expressed in
  9109. range of [0-255].
  9110. @item UMIN
  9111. Display the minimal U value contained within the input frame. Expressed in
  9112. range of [0-255].
  9113. @item ULOW
  9114. Display the U value at the 10% percentile within the input frame. Expressed in
  9115. range of [0-255].
  9116. @item UAVG
  9117. Display the average U value within the input frame. Expressed in range of
  9118. [0-255].
  9119. @item UHIGH
  9120. Display the U value at the 90% percentile within the input frame. Expressed in
  9121. range of [0-255].
  9122. @item UMAX
  9123. Display the maximum U value contained within the input frame. Expressed in
  9124. range of [0-255].
  9125. @item VMIN
  9126. Display the minimal V value contained within the input frame. Expressed in
  9127. range of [0-255].
  9128. @item VLOW
  9129. Display the V value at the 10% percentile within the input frame. Expressed in
  9130. range of [0-255].
  9131. @item VAVG
  9132. Display the average V value within the input frame. Expressed in range of
  9133. [0-255].
  9134. @item VHIGH
  9135. Display the V value at the 90% percentile within the input frame. Expressed in
  9136. range of [0-255].
  9137. @item VMAX
  9138. Display the maximum V value contained within the input frame. Expressed in
  9139. range of [0-255].
  9140. @item SATMIN
  9141. Display the minimal saturation value contained within the input frame.
  9142. Expressed in range of [0-~181.02].
  9143. @item SATLOW
  9144. Display the saturation value at the 10% percentile within the input frame.
  9145. Expressed in range of [0-~181.02].
  9146. @item SATAVG
  9147. Display the average saturation value within the input frame. Expressed in range
  9148. of [0-~181.02].
  9149. @item SATHIGH
  9150. Display the saturation value at the 90% percentile within the input frame.
  9151. Expressed in range of [0-~181.02].
  9152. @item SATMAX
  9153. Display the maximum saturation value contained within the input frame.
  9154. Expressed in range of [0-~181.02].
  9155. @item HUEMED
  9156. Display the median value for hue within the input frame. Expressed in range of
  9157. [0-360].
  9158. @item HUEAVG
  9159. Display the average value for hue within the input frame. Expressed in range of
  9160. [0-360].
  9161. @item YDIF
  9162. Display the average of sample value difference between all values of the Y
  9163. plane in the current frame and corresponding values of the previous input frame.
  9164. Expressed in range of [0-255].
  9165. @item UDIF
  9166. Display the average of sample value difference between all values of the U
  9167. plane in the current frame and corresponding values of the previous input frame.
  9168. Expressed in range of [0-255].
  9169. @item VDIF
  9170. Display the average of sample value difference between all values of the V
  9171. plane in the current frame and corresponding values of the previous input frame.
  9172. Expressed in range of [0-255].
  9173. @end table
  9174. The filter accepts the following options:
  9175. @table @option
  9176. @item stat
  9177. @item out
  9178. @option{stat} specify an additional form of image analysis.
  9179. @option{out} output video with the specified type of pixel highlighted.
  9180. Both options accept the following values:
  9181. @table @samp
  9182. @item tout
  9183. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9184. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9185. include the results of video dropouts, head clogs, or tape tracking issues.
  9186. @item vrep
  9187. Identify @var{vertical line repetition}. Vertical line repetition includes
  9188. similar rows of pixels within a frame. In born-digital video vertical line
  9189. repetition is common, but this pattern is uncommon in video digitized from an
  9190. analog source. When it occurs in video that results from the digitization of an
  9191. analog source it can indicate concealment from a dropout compensator.
  9192. @item brng
  9193. Identify pixels that fall outside of legal broadcast range.
  9194. @end table
  9195. @item color, c
  9196. Set the highlight color for the @option{out} option. The default color is
  9197. yellow.
  9198. @end table
  9199. @subsection Examples
  9200. @itemize
  9201. @item
  9202. Output data of various video metrics:
  9203. @example
  9204. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9205. @end example
  9206. @item
  9207. Output specific data about the minimum and maximum values of the Y plane per frame:
  9208. @example
  9209. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9210. @end example
  9211. @item
  9212. Playback video while highlighting pixels that are outside of broadcast range in red.
  9213. @example
  9214. ffplay example.mov -vf signalstats="out=brng:color=red"
  9215. @end example
  9216. @item
  9217. Playback video with signalstats metadata drawn over the frame.
  9218. @example
  9219. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9220. @end example
  9221. The contents of signalstat_drawtext.txt used in the command are:
  9222. @example
  9223. time %@{pts:hms@}
  9224. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9225. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9226. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9227. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9228. @end example
  9229. @end itemize
  9230. @anchor{smartblur}
  9231. @section smartblur
  9232. Blur the input video without impacting the outlines.
  9233. It accepts the following options:
  9234. @table @option
  9235. @item luma_radius, lr
  9236. Set the luma radius. The option value must be a float number in
  9237. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9238. used to blur the image (slower if larger). Default value is 1.0.
  9239. @item luma_strength, ls
  9240. Set the luma strength. The option value must be a float number
  9241. in the range [-1.0,1.0] that configures the blurring. A value included
  9242. in [0.0,1.0] will blur the image whereas a value included in
  9243. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9244. @item luma_threshold, lt
  9245. Set the luma threshold used as a coefficient to determine
  9246. whether a pixel should be blurred or not. The option value must be an
  9247. integer in the range [-30,30]. A value of 0 will filter all the image,
  9248. a value included in [0,30] will filter flat areas and a value included
  9249. in [-30,0] will filter edges. Default value is 0.
  9250. @item chroma_radius, cr
  9251. Set the chroma radius. The option value must be a float number in
  9252. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9253. used to blur the image (slower if larger). Default value is 1.0.
  9254. @item chroma_strength, cs
  9255. Set the chroma strength. The option value must be a float number
  9256. in the range [-1.0,1.0] that configures the blurring. A value included
  9257. in [0.0,1.0] will blur the image whereas a value included in
  9258. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9259. @item chroma_threshold, ct
  9260. Set the chroma threshold used as a coefficient to determine
  9261. whether a pixel should be blurred or not. The option value must be an
  9262. integer in the range [-30,30]. A value of 0 will filter all the image,
  9263. a value included in [0,30] will filter flat areas and a value included
  9264. in [-30,0] will filter edges. Default value is 0.
  9265. @end table
  9266. If a chroma option is not explicitly set, the corresponding luma value
  9267. is set.
  9268. @section ssim
  9269. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9270. This filter takes in input two input videos, the first input is
  9271. considered the "main" source and is passed unchanged to the
  9272. output. The second input is used as a "reference" video for computing
  9273. the SSIM.
  9274. Both video inputs must have the same resolution and pixel format for
  9275. this filter to work correctly. Also it assumes that both inputs
  9276. have the same number of frames, which are compared one by one.
  9277. The filter stores the calculated SSIM of each frame.
  9278. The description of the accepted parameters follows.
  9279. @table @option
  9280. @item stats_file, f
  9281. If specified the filter will use the named file to save the SSIM of
  9282. each individual frame. When filename equals "-" the data is sent to
  9283. standard output.
  9284. @end table
  9285. The file printed if @var{stats_file} is selected, contains a sequence of
  9286. key/value pairs of the form @var{key}:@var{value} for each compared
  9287. couple of frames.
  9288. A description of each shown parameter follows:
  9289. @table @option
  9290. @item n
  9291. sequential number of the input frame, starting from 1
  9292. @item Y, U, V, R, G, B
  9293. SSIM of the compared frames for the component specified by the suffix.
  9294. @item All
  9295. SSIM of the compared frames for the whole frame.
  9296. @item dB
  9297. Same as above but in dB representation.
  9298. @end table
  9299. For example:
  9300. @example
  9301. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9302. [main][ref] ssim="stats_file=stats.log" [out]
  9303. @end example
  9304. On this example the input file being processed is compared with the
  9305. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9306. is stored in @file{stats.log}.
  9307. Another example with both psnr and ssim at same time:
  9308. @example
  9309. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9310. @end example
  9311. @section stereo3d
  9312. Convert between different stereoscopic image formats.
  9313. The filters accept the following options:
  9314. @table @option
  9315. @item in
  9316. Set stereoscopic image format of input.
  9317. Available values for input image formats are:
  9318. @table @samp
  9319. @item sbsl
  9320. side by side parallel (left eye left, right eye right)
  9321. @item sbsr
  9322. side by side crosseye (right eye left, left eye right)
  9323. @item sbs2l
  9324. side by side parallel with half width resolution
  9325. (left eye left, right eye right)
  9326. @item sbs2r
  9327. side by side crosseye with half width resolution
  9328. (right eye left, left eye right)
  9329. @item abl
  9330. above-below (left eye above, right eye below)
  9331. @item abr
  9332. above-below (right eye above, left eye below)
  9333. @item ab2l
  9334. above-below with half height resolution
  9335. (left eye above, right eye below)
  9336. @item ab2r
  9337. above-below with half height resolution
  9338. (right eye above, left eye below)
  9339. @item al
  9340. alternating frames (left eye first, right eye second)
  9341. @item ar
  9342. alternating frames (right eye first, left eye second)
  9343. @item irl
  9344. interleaved rows (left eye has top row, right eye starts on next row)
  9345. @item irr
  9346. interleaved rows (right eye has top row, left eye starts on next row)
  9347. @item icl
  9348. interleaved columns, left eye first
  9349. @item icr
  9350. interleaved columns, right eye first
  9351. Default value is @samp{sbsl}.
  9352. @end table
  9353. @item out
  9354. Set stereoscopic image format of output.
  9355. @table @samp
  9356. @item sbsl
  9357. side by side parallel (left eye left, right eye right)
  9358. @item sbsr
  9359. side by side crosseye (right eye left, left eye right)
  9360. @item sbs2l
  9361. side by side parallel with half width resolution
  9362. (left eye left, right eye right)
  9363. @item sbs2r
  9364. side by side crosseye with half width resolution
  9365. (right eye left, left eye right)
  9366. @item abl
  9367. above-below (left eye above, right eye below)
  9368. @item abr
  9369. above-below (right eye above, left eye below)
  9370. @item ab2l
  9371. above-below with half height resolution
  9372. (left eye above, right eye below)
  9373. @item ab2r
  9374. above-below with half height resolution
  9375. (right eye above, left eye below)
  9376. @item al
  9377. alternating frames (left eye first, right eye second)
  9378. @item ar
  9379. alternating frames (right eye first, left eye second)
  9380. @item irl
  9381. interleaved rows (left eye has top row, right eye starts on next row)
  9382. @item irr
  9383. interleaved rows (right eye has top row, left eye starts on next row)
  9384. @item arbg
  9385. anaglyph red/blue gray
  9386. (red filter on left eye, blue filter on right eye)
  9387. @item argg
  9388. anaglyph red/green gray
  9389. (red filter on left eye, green filter on right eye)
  9390. @item arcg
  9391. anaglyph red/cyan gray
  9392. (red filter on left eye, cyan filter on right eye)
  9393. @item arch
  9394. anaglyph red/cyan half colored
  9395. (red filter on left eye, cyan filter on right eye)
  9396. @item arcc
  9397. anaglyph red/cyan color
  9398. (red filter on left eye, cyan filter on right eye)
  9399. @item arcd
  9400. anaglyph red/cyan color optimized with the least squares projection of dubois
  9401. (red filter on left eye, cyan filter on right eye)
  9402. @item agmg
  9403. anaglyph green/magenta gray
  9404. (green filter on left eye, magenta filter on right eye)
  9405. @item agmh
  9406. anaglyph green/magenta half colored
  9407. (green filter on left eye, magenta filter on right eye)
  9408. @item agmc
  9409. anaglyph green/magenta colored
  9410. (green filter on left eye, magenta filter on right eye)
  9411. @item agmd
  9412. anaglyph green/magenta color optimized with the least squares projection of dubois
  9413. (green filter on left eye, magenta filter on right eye)
  9414. @item aybg
  9415. anaglyph yellow/blue gray
  9416. (yellow filter on left eye, blue filter on right eye)
  9417. @item aybh
  9418. anaglyph yellow/blue half colored
  9419. (yellow filter on left eye, blue filter on right eye)
  9420. @item aybc
  9421. anaglyph yellow/blue colored
  9422. (yellow filter on left eye, blue filter on right eye)
  9423. @item aybd
  9424. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9425. (yellow filter on left eye, blue filter on right eye)
  9426. @item ml
  9427. mono output (left eye only)
  9428. @item mr
  9429. mono output (right eye only)
  9430. @item chl
  9431. checkerboard, left eye first
  9432. @item chr
  9433. checkerboard, right eye first
  9434. @item icl
  9435. interleaved columns, left eye first
  9436. @item icr
  9437. interleaved columns, right eye first
  9438. @end table
  9439. Default value is @samp{arcd}.
  9440. @end table
  9441. @subsection Examples
  9442. @itemize
  9443. @item
  9444. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9445. @example
  9446. stereo3d=sbsl:aybd
  9447. @end example
  9448. @item
  9449. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9450. @example
  9451. stereo3d=abl:sbsr
  9452. @end example
  9453. @end itemize
  9454. @section streamselect, astreamselect
  9455. Select video or audio streams.
  9456. The filter accepts the following options:
  9457. @table @option
  9458. @item inputs
  9459. Set number of inputs. Default is 2.
  9460. @item map
  9461. Set input indexes to remap to outputs.
  9462. @end table
  9463. @subsection Commands
  9464. The @code{streamselect} and @code{astreamselect} filter supports the following
  9465. commands:
  9466. @table @option
  9467. @item map
  9468. Set input indexes to remap to outputs.
  9469. @end table
  9470. @subsection Examples
  9471. @itemize
  9472. @item
  9473. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9474. @example
  9475. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9476. @end example
  9477. @item
  9478. Same as above, but for audio:
  9479. @example
  9480. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9481. @end example
  9482. @end itemize
  9483. @anchor{spp}
  9484. @section spp
  9485. Apply a simple postprocessing filter that compresses and decompresses the image
  9486. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9487. and average the results.
  9488. The filter accepts the following options:
  9489. @table @option
  9490. @item quality
  9491. Set quality. This option defines the number of levels for averaging. It accepts
  9492. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9493. effect. A value of @code{6} means the higher quality. For each increment of
  9494. that value the speed drops by a factor of approximately 2. Default value is
  9495. @code{3}.
  9496. @item qp
  9497. Force a constant quantization parameter. If not set, the filter will use the QP
  9498. from the video stream (if available).
  9499. @item mode
  9500. Set thresholding mode. Available modes are:
  9501. @table @samp
  9502. @item hard
  9503. Set hard thresholding (default).
  9504. @item soft
  9505. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9506. @end table
  9507. @item use_bframe_qp
  9508. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9509. option may cause flicker since the B-Frames have often larger QP. Default is
  9510. @code{0} (not enabled).
  9511. @end table
  9512. @anchor{subtitles}
  9513. @section subtitles
  9514. Draw subtitles on top of input video using the libass library.
  9515. To enable compilation of this filter you need to configure FFmpeg with
  9516. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9517. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9518. Alpha) subtitles format.
  9519. The filter accepts the following options:
  9520. @table @option
  9521. @item filename, f
  9522. Set the filename of the subtitle file to read. It must be specified.
  9523. @item original_size
  9524. Specify the size of the original video, the video for which the ASS file
  9525. was composed. For the syntax of this option, check the
  9526. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9527. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9528. correctly scale the fonts if the aspect ratio has been changed.
  9529. @item fontsdir
  9530. Set a directory path containing fonts that can be used by the filter.
  9531. These fonts will be used in addition to whatever the font provider uses.
  9532. @item charenc
  9533. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9534. useful if not UTF-8.
  9535. @item stream_index, si
  9536. Set subtitles stream index. @code{subtitles} filter only.
  9537. @item force_style
  9538. Override default style or script info parameters of the subtitles. It accepts a
  9539. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9540. @end table
  9541. If the first key is not specified, it is assumed that the first value
  9542. specifies the @option{filename}.
  9543. For example, to render the file @file{sub.srt} on top of the input
  9544. video, use the command:
  9545. @example
  9546. subtitles=sub.srt
  9547. @end example
  9548. which is equivalent to:
  9549. @example
  9550. subtitles=filename=sub.srt
  9551. @end example
  9552. To render the default subtitles stream from file @file{video.mkv}, use:
  9553. @example
  9554. subtitles=video.mkv
  9555. @end example
  9556. To render the second subtitles stream from that file, use:
  9557. @example
  9558. subtitles=video.mkv:si=1
  9559. @end example
  9560. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9561. @code{DejaVu Serif}, use:
  9562. @example
  9563. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9564. @end example
  9565. @section super2xsai
  9566. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9567. Interpolate) pixel art scaling algorithm.
  9568. Useful for enlarging pixel art images without reducing sharpness.
  9569. @section swaprect
  9570. Swap two rectangular objects in video.
  9571. This filter accepts the following options:
  9572. @table @option
  9573. @item w
  9574. Set object width.
  9575. @item h
  9576. Set object height.
  9577. @item x1
  9578. Set 1st rect x coordinate.
  9579. @item y1
  9580. Set 1st rect y coordinate.
  9581. @item x2
  9582. Set 2nd rect x coordinate.
  9583. @item y2
  9584. Set 2nd rect y coordinate.
  9585. All expressions are evaluated once for each frame.
  9586. @end table
  9587. The all options are expressions containing the following constants:
  9588. @table @option
  9589. @item w
  9590. @item h
  9591. The input width and height.
  9592. @item a
  9593. same as @var{w} / @var{h}
  9594. @item sar
  9595. input sample aspect ratio
  9596. @item dar
  9597. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9598. @item n
  9599. The number of the input frame, starting from 0.
  9600. @item t
  9601. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9602. @item pos
  9603. the position in the file of the input frame, NAN if unknown
  9604. @end table
  9605. @section swapuv
  9606. Swap U & V plane.
  9607. @section telecine
  9608. Apply telecine process to the video.
  9609. This filter accepts the following options:
  9610. @table @option
  9611. @item first_field
  9612. @table @samp
  9613. @item top, t
  9614. top field first
  9615. @item bottom, b
  9616. bottom field first
  9617. The default value is @code{top}.
  9618. @end table
  9619. @item pattern
  9620. A string of numbers representing the pulldown pattern you wish to apply.
  9621. The default value is @code{23}.
  9622. @end table
  9623. @example
  9624. Some typical patterns:
  9625. NTSC output (30i):
  9626. 27.5p: 32222
  9627. 24p: 23 (classic)
  9628. 24p: 2332 (preferred)
  9629. 20p: 33
  9630. 18p: 334
  9631. 16p: 3444
  9632. PAL output (25i):
  9633. 27.5p: 12222
  9634. 24p: 222222222223 ("Euro pulldown")
  9635. 16.67p: 33
  9636. 16p: 33333334
  9637. @end example
  9638. @section thumbnail
  9639. Select the most representative frame in a given sequence of consecutive frames.
  9640. The filter accepts the following options:
  9641. @table @option
  9642. @item n
  9643. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9644. will pick one of them, and then handle the next batch of @var{n} frames until
  9645. the end. Default is @code{100}.
  9646. @end table
  9647. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9648. value will result in a higher memory usage, so a high value is not recommended.
  9649. @subsection Examples
  9650. @itemize
  9651. @item
  9652. Extract one picture each 50 frames:
  9653. @example
  9654. thumbnail=50
  9655. @end example
  9656. @item
  9657. Complete example of a thumbnail creation with @command{ffmpeg}:
  9658. @example
  9659. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9660. @end example
  9661. @end itemize
  9662. @section tile
  9663. Tile several successive frames together.
  9664. The filter accepts the following options:
  9665. @table @option
  9666. @item layout
  9667. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9668. this option, check the
  9669. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9670. @item nb_frames
  9671. Set the maximum number of frames to render in the given area. It must be less
  9672. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9673. the area will be used.
  9674. @item margin
  9675. Set the outer border margin in pixels.
  9676. @item padding
  9677. Set the inner border thickness (i.e. the number of pixels between frames). For
  9678. more advanced padding options (such as having different values for the edges),
  9679. refer to the pad video filter.
  9680. @item color
  9681. Specify the color of the unused area. For the syntax of this option, check the
  9682. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9683. is "black".
  9684. @end table
  9685. @subsection Examples
  9686. @itemize
  9687. @item
  9688. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9689. @example
  9690. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9691. @end example
  9692. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9693. duplicating each output frame to accommodate the originally detected frame
  9694. rate.
  9695. @item
  9696. Display @code{5} pictures in an area of @code{3x2} frames,
  9697. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9698. mixed flat and named options:
  9699. @example
  9700. tile=3x2:nb_frames=5:padding=7:margin=2
  9701. @end example
  9702. @end itemize
  9703. @section tinterlace
  9704. Perform various types of temporal field interlacing.
  9705. Frames are counted starting from 1, so the first input frame is
  9706. considered odd.
  9707. The filter accepts the following options:
  9708. @table @option
  9709. @item mode
  9710. Specify the mode of the interlacing. This option can also be specified
  9711. as a value alone. See below for a list of values for this option.
  9712. Available values are:
  9713. @table @samp
  9714. @item merge, 0
  9715. Move odd frames into the upper field, even into the lower field,
  9716. generating a double height frame at half frame rate.
  9717. @example
  9718. ------> time
  9719. Input:
  9720. Frame 1 Frame 2 Frame 3 Frame 4
  9721. 11111 22222 33333 44444
  9722. 11111 22222 33333 44444
  9723. 11111 22222 33333 44444
  9724. 11111 22222 33333 44444
  9725. Output:
  9726. 11111 33333
  9727. 22222 44444
  9728. 11111 33333
  9729. 22222 44444
  9730. 11111 33333
  9731. 22222 44444
  9732. 11111 33333
  9733. 22222 44444
  9734. @end example
  9735. @item drop_even, 1
  9736. Only output odd frames, even frames are dropped, generating a frame with
  9737. unchanged height at half frame rate.
  9738. @example
  9739. ------> time
  9740. Input:
  9741. Frame 1 Frame 2 Frame 3 Frame 4
  9742. 11111 22222 33333 44444
  9743. 11111 22222 33333 44444
  9744. 11111 22222 33333 44444
  9745. 11111 22222 33333 44444
  9746. Output:
  9747. 11111 33333
  9748. 11111 33333
  9749. 11111 33333
  9750. 11111 33333
  9751. @end example
  9752. @item drop_odd, 2
  9753. Only output even frames, odd frames are dropped, generating a frame with
  9754. unchanged height at half frame rate.
  9755. @example
  9756. ------> time
  9757. Input:
  9758. Frame 1 Frame 2 Frame 3 Frame 4
  9759. 11111 22222 33333 44444
  9760. 11111 22222 33333 44444
  9761. 11111 22222 33333 44444
  9762. 11111 22222 33333 44444
  9763. Output:
  9764. 22222 44444
  9765. 22222 44444
  9766. 22222 44444
  9767. 22222 44444
  9768. @end example
  9769. @item pad, 3
  9770. Expand each frame to full height, but pad alternate lines with black,
  9771. generating a frame with double height at the same input frame rate.
  9772. @example
  9773. ------> time
  9774. Input:
  9775. Frame 1 Frame 2 Frame 3 Frame 4
  9776. 11111 22222 33333 44444
  9777. 11111 22222 33333 44444
  9778. 11111 22222 33333 44444
  9779. 11111 22222 33333 44444
  9780. Output:
  9781. 11111 ..... 33333 .....
  9782. ..... 22222 ..... 44444
  9783. 11111 ..... 33333 .....
  9784. ..... 22222 ..... 44444
  9785. 11111 ..... 33333 .....
  9786. ..... 22222 ..... 44444
  9787. 11111 ..... 33333 .....
  9788. ..... 22222 ..... 44444
  9789. @end example
  9790. @item interleave_top, 4
  9791. Interleave the upper field from odd frames with the lower field from
  9792. even frames, generating a frame with unchanged height at half frame rate.
  9793. @example
  9794. ------> time
  9795. Input:
  9796. Frame 1 Frame 2 Frame 3 Frame 4
  9797. 11111<- 22222 33333<- 44444
  9798. 11111 22222<- 33333 44444<-
  9799. 11111<- 22222 33333<- 44444
  9800. 11111 22222<- 33333 44444<-
  9801. Output:
  9802. 11111 33333
  9803. 22222 44444
  9804. 11111 33333
  9805. 22222 44444
  9806. @end example
  9807. @item interleave_bottom, 5
  9808. Interleave the lower field from odd frames with the upper field from
  9809. even frames, generating a frame with unchanged height at half frame rate.
  9810. @example
  9811. ------> time
  9812. Input:
  9813. Frame 1 Frame 2 Frame 3 Frame 4
  9814. 11111 22222<- 33333 44444<-
  9815. 11111<- 22222 33333<- 44444
  9816. 11111 22222<- 33333 44444<-
  9817. 11111<- 22222 33333<- 44444
  9818. Output:
  9819. 22222 44444
  9820. 11111 33333
  9821. 22222 44444
  9822. 11111 33333
  9823. @end example
  9824. @item interlacex2, 6
  9825. Double frame rate with unchanged height. Frames are inserted each
  9826. containing the second temporal field from the previous input frame and
  9827. the first temporal field from the next input frame. This mode relies on
  9828. the top_field_first flag. Useful for interlaced video displays with no
  9829. field synchronisation.
  9830. @example
  9831. ------> time
  9832. Input:
  9833. Frame 1 Frame 2 Frame 3 Frame 4
  9834. 11111 22222 33333 44444
  9835. 11111 22222 33333 44444
  9836. 11111 22222 33333 44444
  9837. 11111 22222 33333 44444
  9838. Output:
  9839. 11111 22222 22222 33333 33333 44444 44444
  9840. 11111 11111 22222 22222 33333 33333 44444
  9841. 11111 22222 22222 33333 33333 44444 44444
  9842. 11111 11111 22222 22222 33333 33333 44444
  9843. @end example
  9844. @item mergex2, 7
  9845. Move odd frames into the upper field, even into the lower field,
  9846. generating a double height frame at same frame rate.
  9847. @example
  9848. ------> time
  9849. Input:
  9850. Frame 1 Frame 2 Frame 3 Frame 4
  9851. 11111 22222 33333 44444
  9852. 11111 22222 33333 44444
  9853. 11111 22222 33333 44444
  9854. 11111 22222 33333 44444
  9855. Output:
  9856. 11111 33333 33333 55555
  9857. 22222 22222 44444 44444
  9858. 11111 33333 33333 55555
  9859. 22222 22222 44444 44444
  9860. 11111 33333 33333 55555
  9861. 22222 22222 44444 44444
  9862. 11111 33333 33333 55555
  9863. 22222 22222 44444 44444
  9864. @end example
  9865. @end table
  9866. Numeric values are deprecated but are accepted for backward
  9867. compatibility reasons.
  9868. Default mode is @code{merge}.
  9869. @item flags
  9870. Specify flags influencing the filter process.
  9871. Available value for @var{flags} is:
  9872. @table @option
  9873. @item low_pass_filter, vlfp
  9874. Enable vertical low-pass filtering in the filter.
  9875. Vertical low-pass filtering is required when creating an interlaced
  9876. destination from a progressive source which contains high-frequency
  9877. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9878. patterning.
  9879. Vertical low-pass filtering can only be enabled for @option{mode}
  9880. @var{interleave_top} and @var{interleave_bottom}.
  9881. @end table
  9882. @end table
  9883. @section transpose
  9884. Transpose rows with columns in the input video and optionally flip it.
  9885. It accepts the following parameters:
  9886. @table @option
  9887. @item dir
  9888. Specify the transposition direction.
  9889. Can assume the following values:
  9890. @table @samp
  9891. @item 0, 4, cclock_flip
  9892. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9893. @example
  9894. L.R L.l
  9895. . . -> . .
  9896. l.r R.r
  9897. @end example
  9898. @item 1, 5, clock
  9899. Rotate by 90 degrees clockwise, that is:
  9900. @example
  9901. L.R l.L
  9902. . . -> . .
  9903. l.r r.R
  9904. @end example
  9905. @item 2, 6, cclock
  9906. Rotate by 90 degrees counterclockwise, that is:
  9907. @example
  9908. L.R R.r
  9909. . . -> . .
  9910. l.r L.l
  9911. @end example
  9912. @item 3, 7, clock_flip
  9913. Rotate by 90 degrees clockwise and vertically flip, that is:
  9914. @example
  9915. L.R r.R
  9916. . . -> . .
  9917. l.r l.L
  9918. @end example
  9919. @end table
  9920. For values between 4-7, the transposition is only done if the input
  9921. video geometry is portrait and not landscape. These values are
  9922. deprecated, the @code{passthrough} option should be used instead.
  9923. Numerical values are deprecated, and should be dropped in favor of
  9924. symbolic constants.
  9925. @item passthrough
  9926. Do not apply the transposition if the input geometry matches the one
  9927. specified by the specified value. It accepts the following values:
  9928. @table @samp
  9929. @item none
  9930. Always apply transposition.
  9931. @item portrait
  9932. Preserve portrait geometry (when @var{height} >= @var{width}).
  9933. @item landscape
  9934. Preserve landscape geometry (when @var{width} >= @var{height}).
  9935. @end table
  9936. Default value is @code{none}.
  9937. @end table
  9938. For example to rotate by 90 degrees clockwise and preserve portrait
  9939. layout:
  9940. @example
  9941. transpose=dir=1:passthrough=portrait
  9942. @end example
  9943. The command above can also be specified as:
  9944. @example
  9945. transpose=1:portrait
  9946. @end example
  9947. @section trim
  9948. Trim the input so that the output contains one continuous subpart of the input.
  9949. It accepts the following parameters:
  9950. @table @option
  9951. @item start
  9952. Specify the time of the start of the kept section, i.e. the frame with the
  9953. timestamp @var{start} will be the first frame in the output.
  9954. @item end
  9955. Specify the time of the first frame that will be dropped, i.e. the frame
  9956. immediately preceding the one with the timestamp @var{end} will be the last
  9957. frame in the output.
  9958. @item start_pts
  9959. This is the same as @var{start}, except this option sets the start timestamp
  9960. in timebase units instead of seconds.
  9961. @item end_pts
  9962. This is the same as @var{end}, except this option sets the end timestamp
  9963. in timebase units instead of seconds.
  9964. @item duration
  9965. The maximum duration of the output in seconds.
  9966. @item start_frame
  9967. The number of the first frame that should be passed to the output.
  9968. @item end_frame
  9969. The number of the first frame that should be dropped.
  9970. @end table
  9971. @option{start}, @option{end}, and @option{duration} are expressed as time
  9972. duration specifications; see
  9973. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9974. for the accepted syntax.
  9975. Note that the first two sets of the start/end options and the @option{duration}
  9976. option look at the frame timestamp, while the _frame variants simply count the
  9977. frames that pass through the filter. Also note that this filter does not modify
  9978. the timestamps. If you wish for the output timestamps to start at zero, insert a
  9979. setpts filter after the trim filter.
  9980. If multiple start or end options are set, this filter tries to be greedy and
  9981. keep all the frames that match at least one of the specified constraints. To keep
  9982. only the part that matches all the constraints at once, chain multiple trim
  9983. filters.
  9984. The defaults are such that all the input is kept. So it is possible to set e.g.
  9985. just the end values to keep everything before the specified time.
  9986. Examples:
  9987. @itemize
  9988. @item
  9989. Drop everything except the second minute of input:
  9990. @example
  9991. ffmpeg -i INPUT -vf trim=60:120
  9992. @end example
  9993. @item
  9994. Keep only the first second:
  9995. @example
  9996. ffmpeg -i INPUT -vf trim=duration=1
  9997. @end example
  9998. @end itemize
  9999. @anchor{unsharp}
  10000. @section unsharp
  10001. Sharpen or blur the input video.
  10002. It accepts the following parameters:
  10003. @table @option
  10004. @item luma_msize_x, lx
  10005. Set the luma matrix horizontal size. It must be an odd integer between
  10006. 3 and 63. The default value is 5.
  10007. @item luma_msize_y, ly
  10008. Set the luma matrix vertical size. It must be an odd integer between 3
  10009. and 63. The default value is 5.
  10010. @item luma_amount, la
  10011. Set the luma effect strength. It must be a floating point number, reasonable
  10012. values lay between -1.5 and 1.5.
  10013. Negative values will blur the input video, while positive values will
  10014. sharpen it, a value of zero will disable the effect.
  10015. Default value is 1.0.
  10016. @item chroma_msize_x, cx
  10017. Set the chroma matrix horizontal size. It must be an odd integer
  10018. between 3 and 63. The default value is 5.
  10019. @item chroma_msize_y, cy
  10020. Set the chroma matrix vertical size. It must be an odd integer
  10021. between 3 and 63. The default value is 5.
  10022. @item chroma_amount, ca
  10023. Set the chroma effect strength. It must be a floating point number, reasonable
  10024. values lay between -1.5 and 1.5.
  10025. Negative values will blur the input video, while positive values will
  10026. sharpen it, a value of zero will disable the effect.
  10027. Default value is 0.0.
  10028. @item opencl
  10029. If set to 1, specify using OpenCL capabilities, only available if
  10030. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10031. @end table
  10032. All parameters are optional and default to the equivalent of the
  10033. string '5:5:1.0:5:5:0.0'.
  10034. @subsection Examples
  10035. @itemize
  10036. @item
  10037. Apply strong luma sharpen effect:
  10038. @example
  10039. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10040. @end example
  10041. @item
  10042. Apply a strong blur of both luma and chroma parameters:
  10043. @example
  10044. unsharp=7:7:-2:7:7:-2
  10045. @end example
  10046. @end itemize
  10047. @section uspp
  10048. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10049. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10050. shifts and average the results.
  10051. The way this differs from the behavior of spp is that uspp actually encodes &
  10052. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10053. DCT similar to MJPEG.
  10054. The filter accepts the following options:
  10055. @table @option
  10056. @item quality
  10057. Set quality. This option defines the number of levels for averaging. It accepts
  10058. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10059. effect. A value of @code{8} means the higher quality. For each increment of
  10060. that value the speed drops by a factor of approximately 2. Default value is
  10061. @code{3}.
  10062. @item qp
  10063. Force a constant quantization parameter. If not set, the filter will use the QP
  10064. from the video stream (if available).
  10065. @end table
  10066. @section vectorscope
  10067. Display 2 color component values in the two dimensional graph (which is called
  10068. a vectorscope).
  10069. This filter accepts the following options:
  10070. @table @option
  10071. @item mode, m
  10072. Set vectorscope mode.
  10073. It accepts the following values:
  10074. @table @samp
  10075. @item gray
  10076. Gray values are displayed on graph, higher brightness means more pixels have
  10077. same component color value on location in graph. This is the default mode.
  10078. @item color
  10079. Gray values are displayed on graph. Surrounding pixels values which are not
  10080. present in video frame are drawn in gradient of 2 color components which are
  10081. set by option @code{x} and @code{y}. The 3rd color component is static.
  10082. @item color2
  10083. Actual color components values present in video frame are displayed on graph.
  10084. @item color3
  10085. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10086. on graph increases value of another color component, which is luminance by
  10087. default values of @code{x} and @code{y}.
  10088. @item color4
  10089. Actual colors present in video frame are displayed on graph. If two different
  10090. colors map to same position on graph then color with higher value of component
  10091. not present in graph is picked.
  10092. @item color5
  10093. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10094. component picked from radial gradient.
  10095. @end table
  10096. @item x
  10097. Set which color component will be represented on X-axis. Default is @code{1}.
  10098. @item y
  10099. Set which color component will be represented on Y-axis. Default is @code{2}.
  10100. @item intensity, i
  10101. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10102. of color component which represents frequency of (X, Y) location in graph.
  10103. @item envelope, e
  10104. @table @samp
  10105. @item none
  10106. No envelope, this is default.
  10107. @item instant
  10108. Instant envelope, even darkest single pixel will be clearly highlighted.
  10109. @item peak
  10110. Hold maximum and minimum values presented in graph over time. This way you
  10111. can still spot out of range values without constantly looking at vectorscope.
  10112. @item peak+instant
  10113. Peak and instant envelope combined together.
  10114. @end table
  10115. @item graticule, g
  10116. Set what kind of graticule to draw.
  10117. @table @samp
  10118. @item none
  10119. @item green
  10120. @item color
  10121. @end table
  10122. @item opacity, o
  10123. Set graticule opacity.
  10124. @item flags, f
  10125. Set graticule flags.
  10126. @table @samp
  10127. @item white
  10128. Draw graticule for white point.
  10129. @item black
  10130. Draw graticule for black point.
  10131. @item name
  10132. Draw color points short names.
  10133. @end table
  10134. @item bgopacity, b
  10135. Set background opacity.
  10136. @item lthreshold, l
  10137. Set low threshold for color component not represented on X or Y axis.
  10138. Values lower than this value will be ignored. Default is 0.
  10139. Note this value is multiplied with actual max possible value one pixel component
  10140. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10141. is 0.1 * 255 = 25.
  10142. @item hthreshold, h
  10143. Set high threshold for color component not represented on X or Y axis.
  10144. Values higher than this value will be ignored. Default is 1.
  10145. Note this value is multiplied with actual max possible value one pixel component
  10146. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10147. is 0.9 * 255 = 230.
  10148. @item colorspace, c
  10149. Set what kind of colorspace to use when drawing graticule.
  10150. @table @samp
  10151. @item auto
  10152. @item 601
  10153. @item 709
  10154. @end table
  10155. Default is auto.
  10156. @end table
  10157. @anchor{vidstabdetect}
  10158. @section vidstabdetect
  10159. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10160. @ref{vidstabtransform} for pass 2.
  10161. This filter generates a file with relative translation and rotation
  10162. transform information about subsequent frames, which is then used by
  10163. the @ref{vidstabtransform} filter.
  10164. To enable compilation of this filter you need to configure FFmpeg with
  10165. @code{--enable-libvidstab}.
  10166. This filter accepts the following options:
  10167. @table @option
  10168. @item result
  10169. Set the path to the file used to write the transforms information.
  10170. Default value is @file{transforms.trf}.
  10171. @item shakiness
  10172. Set how shaky the video is and how quick the camera is. It accepts an
  10173. integer in the range 1-10, a value of 1 means little shakiness, a
  10174. value of 10 means strong shakiness. Default value is 5.
  10175. @item accuracy
  10176. Set the accuracy of the detection process. It must be a value in the
  10177. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10178. accuracy. Default value is 15.
  10179. @item stepsize
  10180. Set stepsize of the search process. The region around minimum is
  10181. scanned with 1 pixel resolution. Default value is 6.
  10182. @item mincontrast
  10183. Set minimum contrast. Below this value a local measurement field is
  10184. discarded. Must be a floating point value in the range 0-1. Default
  10185. value is 0.3.
  10186. @item tripod
  10187. Set reference frame number for tripod mode.
  10188. If enabled, the motion of the frames is compared to a reference frame
  10189. in the filtered stream, identified by the specified number. The idea
  10190. is to compensate all movements in a more-or-less static scene and keep
  10191. the camera view absolutely still.
  10192. If set to 0, it is disabled. The frames are counted starting from 1.
  10193. @item show
  10194. Show fields and transforms in the resulting frames. It accepts an
  10195. integer in the range 0-2. Default value is 0, which disables any
  10196. visualization.
  10197. @end table
  10198. @subsection Examples
  10199. @itemize
  10200. @item
  10201. Use default values:
  10202. @example
  10203. vidstabdetect
  10204. @end example
  10205. @item
  10206. Analyze strongly shaky movie and put the results in file
  10207. @file{mytransforms.trf}:
  10208. @example
  10209. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10210. @end example
  10211. @item
  10212. Visualize the result of internal transformations in the resulting
  10213. video:
  10214. @example
  10215. vidstabdetect=show=1
  10216. @end example
  10217. @item
  10218. Analyze a video with medium shakiness using @command{ffmpeg}:
  10219. @example
  10220. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10221. @end example
  10222. @end itemize
  10223. @anchor{vidstabtransform}
  10224. @section vidstabtransform
  10225. Video stabilization/deshaking: pass 2 of 2,
  10226. see @ref{vidstabdetect} for pass 1.
  10227. Read a file with transform information for each frame and
  10228. apply/compensate them. Together with the @ref{vidstabdetect}
  10229. filter this can be used to deshake videos. See also
  10230. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10231. the @ref{unsharp} filter, see below.
  10232. To enable compilation of this filter you need to configure FFmpeg with
  10233. @code{--enable-libvidstab}.
  10234. @subsection Options
  10235. @table @option
  10236. @item input
  10237. Set path to the file used to read the transforms. Default value is
  10238. @file{transforms.trf}.
  10239. @item smoothing
  10240. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10241. camera movements. Default value is 10.
  10242. For example a number of 10 means that 21 frames are used (10 in the
  10243. past and 10 in the future) to smoothen the motion in the video. A
  10244. larger value leads to a smoother video, but limits the acceleration of
  10245. the camera (pan/tilt movements). 0 is a special case where a static
  10246. camera is simulated.
  10247. @item optalgo
  10248. Set the camera path optimization algorithm.
  10249. Accepted values are:
  10250. @table @samp
  10251. @item gauss
  10252. gaussian kernel low-pass filter on camera motion (default)
  10253. @item avg
  10254. averaging on transformations
  10255. @end table
  10256. @item maxshift
  10257. Set maximal number of pixels to translate frames. Default value is -1,
  10258. meaning no limit.
  10259. @item maxangle
  10260. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10261. value is -1, meaning no limit.
  10262. @item crop
  10263. Specify how to deal with borders that may be visible due to movement
  10264. compensation.
  10265. Available values are:
  10266. @table @samp
  10267. @item keep
  10268. keep image information from previous frame (default)
  10269. @item black
  10270. fill the border black
  10271. @end table
  10272. @item invert
  10273. Invert transforms if set to 1. Default value is 0.
  10274. @item relative
  10275. Consider transforms as relative to previous frame if set to 1,
  10276. absolute if set to 0. Default value is 0.
  10277. @item zoom
  10278. Set percentage to zoom. A positive value will result in a zoom-in
  10279. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10280. zoom).
  10281. @item optzoom
  10282. Set optimal zooming to avoid borders.
  10283. Accepted values are:
  10284. @table @samp
  10285. @item 0
  10286. disabled
  10287. @item 1
  10288. optimal static zoom value is determined (only very strong movements
  10289. will lead to visible borders) (default)
  10290. @item 2
  10291. optimal adaptive zoom value is determined (no borders will be
  10292. visible), see @option{zoomspeed}
  10293. @end table
  10294. Note that the value given at zoom is added to the one calculated here.
  10295. @item zoomspeed
  10296. Set percent to zoom maximally each frame (enabled when
  10297. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10298. 0.25.
  10299. @item interpol
  10300. Specify type of interpolation.
  10301. Available values are:
  10302. @table @samp
  10303. @item no
  10304. no interpolation
  10305. @item linear
  10306. linear only horizontal
  10307. @item bilinear
  10308. linear in both directions (default)
  10309. @item bicubic
  10310. cubic in both directions (slow)
  10311. @end table
  10312. @item tripod
  10313. Enable virtual tripod mode if set to 1, which is equivalent to
  10314. @code{relative=0:smoothing=0}. Default value is 0.
  10315. Use also @code{tripod} option of @ref{vidstabdetect}.
  10316. @item debug
  10317. Increase log verbosity if set to 1. Also the detected global motions
  10318. are written to the temporary file @file{global_motions.trf}. Default
  10319. value is 0.
  10320. @end table
  10321. @subsection Examples
  10322. @itemize
  10323. @item
  10324. Use @command{ffmpeg} for a typical stabilization with default values:
  10325. @example
  10326. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10327. @end example
  10328. Note the use of the @ref{unsharp} filter which is always recommended.
  10329. @item
  10330. Zoom in a bit more and load transform data from a given file:
  10331. @example
  10332. vidstabtransform=zoom=5:input="mytransforms.trf"
  10333. @end example
  10334. @item
  10335. Smoothen the video even more:
  10336. @example
  10337. vidstabtransform=smoothing=30
  10338. @end example
  10339. @end itemize
  10340. @section vflip
  10341. Flip the input video vertically.
  10342. For example, to vertically flip a video with @command{ffmpeg}:
  10343. @example
  10344. ffmpeg -i in.avi -vf "vflip" out.avi
  10345. @end example
  10346. @anchor{vignette}
  10347. @section vignette
  10348. Make or reverse a natural vignetting effect.
  10349. The filter accepts the following options:
  10350. @table @option
  10351. @item angle, a
  10352. Set lens angle expression as a number of radians.
  10353. The value is clipped in the @code{[0,PI/2]} range.
  10354. Default value: @code{"PI/5"}
  10355. @item x0
  10356. @item y0
  10357. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10358. by default.
  10359. @item mode
  10360. Set forward/backward mode.
  10361. Available modes are:
  10362. @table @samp
  10363. @item forward
  10364. The larger the distance from the central point, the darker the image becomes.
  10365. @item backward
  10366. The larger the distance from the central point, the brighter the image becomes.
  10367. This can be used to reverse a vignette effect, though there is no automatic
  10368. detection to extract the lens @option{angle} and other settings (yet). It can
  10369. also be used to create a burning effect.
  10370. @end table
  10371. Default value is @samp{forward}.
  10372. @item eval
  10373. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10374. It accepts the following values:
  10375. @table @samp
  10376. @item init
  10377. Evaluate expressions only once during the filter initialization.
  10378. @item frame
  10379. Evaluate expressions for each incoming frame. This is way slower than the
  10380. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10381. allows advanced dynamic expressions.
  10382. @end table
  10383. Default value is @samp{init}.
  10384. @item dither
  10385. Set dithering to reduce the circular banding effects. Default is @code{1}
  10386. (enabled).
  10387. @item aspect
  10388. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10389. Setting this value to the SAR of the input will make a rectangular vignetting
  10390. following the dimensions of the video.
  10391. Default is @code{1/1}.
  10392. @end table
  10393. @subsection Expressions
  10394. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10395. following parameters.
  10396. @table @option
  10397. @item w
  10398. @item h
  10399. input width and height
  10400. @item n
  10401. the number of input frame, starting from 0
  10402. @item pts
  10403. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10404. @var{TB} units, NAN if undefined
  10405. @item r
  10406. frame rate of the input video, NAN if the input frame rate is unknown
  10407. @item t
  10408. the PTS (Presentation TimeStamp) of the filtered video frame,
  10409. expressed in seconds, NAN if undefined
  10410. @item tb
  10411. time base of the input video
  10412. @end table
  10413. @subsection Examples
  10414. @itemize
  10415. @item
  10416. Apply simple strong vignetting effect:
  10417. @example
  10418. vignette=PI/4
  10419. @end example
  10420. @item
  10421. Make a flickering vignetting:
  10422. @example
  10423. vignette='PI/4+random(1)*PI/50':eval=frame
  10424. @end example
  10425. @end itemize
  10426. @section vstack
  10427. Stack input videos vertically.
  10428. All streams must be of same pixel format and of same width.
  10429. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10430. to create same output.
  10431. The filter accept the following option:
  10432. @table @option
  10433. @item inputs
  10434. Set number of input streams. Default is 2.
  10435. @item shortest
  10436. If set to 1, force the output to terminate when the shortest input
  10437. terminates. Default value is 0.
  10438. @end table
  10439. @section w3fdif
  10440. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10441. Deinterlacing Filter").
  10442. Based on the process described by Martin Weston for BBC R&D, and
  10443. implemented based on the de-interlace algorithm written by Jim
  10444. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10445. uses filter coefficients calculated by BBC R&D.
  10446. There are two sets of filter coefficients, so called "simple":
  10447. and "complex". Which set of filter coefficients is used can
  10448. be set by passing an optional parameter:
  10449. @table @option
  10450. @item filter
  10451. Set the interlacing filter coefficients. Accepts one of the following values:
  10452. @table @samp
  10453. @item simple
  10454. Simple filter coefficient set.
  10455. @item complex
  10456. More-complex filter coefficient set.
  10457. @end table
  10458. Default value is @samp{complex}.
  10459. @item deint
  10460. Specify which frames to deinterlace. Accept one of the following values:
  10461. @table @samp
  10462. @item all
  10463. Deinterlace all frames,
  10464. @item interlaced
  10465. Only deinterlace frames marked as interlaced.
  10466. @end table
  10467. Default value is @samp{all}.
  10468. @end table
  10469. @section waveform
  10470. Video waveform monitor.
  10471. The waveform monitor plots color component intensity. By default luminance
  10472. only. Each column of the waveform corresponds to a column of pixels in the
  10473. source video.
  10474. It accepts the following options:
  10475. @table @option
  10476. @item mode, m
  10477. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10478. In row mode, the graph on the left side represents color component value 0 and
  10479. the right side represents value = 255. In column mode, the top side represents
  10480. color component value = 0 and bottom side represents value = 255.
  10481. @item intensity, i
  10482. Set intensity. Smaller values are useful to find out how many values of the same
  10483. luminance are distributed across input rows/columns.
  10484. Default value is @code{0.04}. Allowed range is [0, 1].
  10485. @item mirror, r
  10486. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10487. In mirrored mode, higher values will be represented on the left
  10488. side for @code{row} mode and at the top for @code{column} mode. Default is
  10489. @code{1} (mirrored).
  10490. @item display, d
  10491. Set display mode.
  10492. It accepts the following values:
  10493. @table @samp
  10494. @item overlay
  10495. Presents information identical to that in the @code{parade}, except
  10496. that the graphs representing color components are superimposed directly
  10497. over one another.
  10498. This display mode makes it easier to spot relative differences or similarities
  10499. in overlapping areas of the color components that are supposed to be identical,
  10500. such as neutral whites, grays, or blacks.
  10501. @item stack
  10502. Display separate graph for the color components side by side in
  10503. @code{row} mode or one below the other in @code{column} mode.
  10504. @item parade
  10505. Display separate graph for the color components side by side in
  10506. @code{column} mode or one below the other in @code{row} mode.
  10507. Using this display mode makes it easy to spot color casts in the highlights
  10508. and shadows of an image, by comparing the contours of the top and the bottom
  10509. graphs of each waveform. Since whites, grays, and blacks are characterized
  10510. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10511. should display three waveforms of roughly equal width/height. If not, the
  10512. correction is easy to perform by making level adjustments the three waveforms.
  10513. @end table
  10514. Default is @code{stack}.
  10515. @item components, c
  10516. Set which color components to display. Default is 1, which means only luminance
  10517. or red color component if input is in RGB colorspace. If is set for example to
  10518. 7 it will display all 3 (if) available color components.
  10519. @item envelope, e
  10520. @table @samp
  10521. @item none
  10522. No envelope, this is default.
  10523. @item instant
  10524. Instant envelope, minimum and maximum values presented in graph will be easily
  10525. visible even with small @code{step} value.
  10526. @item peak
  10527. Hold minimum and maximum values presented in graph across time. This way you
  10528. can still spot out of range values without constantly looking at waveforms.
  10529. @item peak+instant
  10530. Peak and instant envelope combined together.
  10531. @end table
  10532. @item filter, f
  10533. @table @samp
  10534. @item lowpass
  10535. No filtering, this is default.
  10536. @item flat
  10537. Luma and chroma combined together.
  10538. @item aflat
  10539. Similar as above, but shows difference between blue and red chroma.
  10540. @item chroma
  10541. Displays only chroma.
  10542. @item color
  10543. Displays actual color value on waveform.
  10544. @item acolor
  10545. Similar as above, but with luma showing frequency of chroma values.
  10546. @end table
  10547. @item graticule, g
  10548. Set which graticule to display.
  10549. @table @samp
  10550. @item none
  10551. Do not display graticule.
  10552. @item green
  10553. Display green graticule showing legal broadcast ranges.
  10554. @end table
  10555. @item opacity, o
  10556. Set graticule opacity.
  10557. @item flags, fl
  10558. Set graticule flags.
  10559. @table @samp
  10560. @item numbers
  10561. Draw numbers above lines. By default enabled.
  10562. @item dots
  10563. Draw dots instead of lines.
  10564. @end table
  10565. @item scale, s
  10566. Set scale used for displaying graticule.
  10567. @table @samp
  10568. @item digital
  10569. @item millivolts
  10570. @item ire
  10571. @end table
  10572. Default is digital.
  10573. @end table
  10574. @section xbr
  10575. Apply the xBR high-quality magnification filter which is designed for pixel
  10576. art. It follows a set of edge-detection rules, see
  10577. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10578. It accepts the following option:
  10579. @table @option
  10580. @item n
  10581. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10582. @code{3xBR} and @code{4} for @code{4xBR}.
  10583. Default is @code{3}.
  10584. @end table
  10585. @anchor{yadif}
  10586. @section yadif
  10587. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10588. filter").
  10589. It accepts the following parameters:
  10590. @table @option
  10591. @item mode
  10592. The interlacing mode to adopt. It accepts one of the following values:
  10593. @table @option
  10594. @item 0, send_frame
  10595. Output one frame for each frame.
  10596. @item 1, send_field
  10597. Output one frame for each field.
  10598. @item 2, send_frame_nospatial
  10599. Like @code{send_frame}, but it skips the spatial interlacing check.
  10600. @item 3, send_field_nospatial
  10601. Like @code{send_field}, but it skips the spatial interlacing check.
  10602. @end table
  10603. The default value is @code{send_frame}.
  10604. @item parity
  10605. The picture field parity assumed for the input interlaced video. It accepts one
  10606. of the following values:
  10607. @table @option
  10608. @item 0, tff
  10609. Assume the top field is first.
  10610. @item 1, bff
  10611. Assume the bottom field is first.
  10612. @item -1, auto
  10613. Enable automatic detection of field parity.
  10614. @end table
  10615. The default value is @code{auto}.
  10616. If the interlacing is unknown or the decoder does not export this information,
  10617. top field first will be assumed.
  10618. @item deint
  10619. Specify which frames to deinterlace. Accept one of the following
  10620. values:
  10621. @table @option
  10622. @item 0, all
  10623. Deinterlace all frames.
  10624. @item 1, interlaced
  10625. Only deinterlace frames marked as interlaced.
  10626. @end table
  10627. The default value is @code{all}.
  10628. @end table
  10629. @section zoompan
  10630. Apply Zoom & Pan effect.
  10631. This filter accepts the following options:
  10632. @table @option
  10633. @item zoom, z
  10634. Set the zoom expression. Default is 1.
  10635. @item x
  10636. @item y
  10637. Set the x and y expression. Default is 0.
  10638. @item d
  10639. Set the duration expression in number of frames.
  10640. This sets for how many number of frames effect will last for
  10641. single input image.
  10642. @item s
  10643. Set the output image size, default is 'hd720'.
  10644. @item fps
  10645. Set the output frame rate, default is '25'.
  10646. @end table
  10647. Each expression can contain the following constants:
  10648. @table @option
  10649. @item in_w, iw
  10650. Input width.
  10651. @item in_h, ih
  10652. Input height.
  10653. @item out_w, ow
  10654. Output width.
  10655. @item out_h, oh
  10656. Output height.
  10657. @item in
  10658. Input frame count.
  10659. @item on
  10660. Output frame count.
  10661. @item x
  10662. @item y
  10663. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10664. for current input frame.
  10665. @item px
  10666. @item py
  10667. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10668. not yet such frame (first input frame).
  10669. @item zoom
  10670. Last calculated zoom from 'z' expression for current input frame.
  10671. @item pzoom
  10672. Last calculated zoom of last output frame of previous input frame.
  10673. @item duration
  10674. Number of output frames for current input frame. Calculated from 'd' expression
  10675. for each input frame.
  10676. @item pduration
  10677. number of output frames created for previous input frame
  10678. @item a
  10679. Rational number: input width / input height
  10680. @item sar
  10681. sample aspect ratio
  10682. @item dar
  10683. display aspect ratio
  10684. @end table
  10685. @subsection Examples
  10686. @itemize
  10687. @item
  10688. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10689. @example
  10690. 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
  10691. @end example
  10692. @item
  10693. Zoom-in up to 1.5 and pan always at center of picture:
  10694. @example
  10695. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10696. @end example
  10697. @end itemize
  10698. @section zscale
  10699. Scale (resize) the input video, using the z.lib library:
  10700. https://github.com/sekrit-twc/zimg.
  10701. The zscale filter forces the output display aspect ratio to be the same
  10702. as the input, by changing the output sample aspect ratio.
  10703. If the input image format is different from the format requested by
  10704. the next filter, the zscale filter will convert the input to the
  10705. requested format.
  10706. @subsection Options
  10707. The filter accepts the following options.
  10708. @table @option
  10709. @item width, w
  10710. @item height, h
  10711. Set the output video dimension expression. Default value is the input
  10712. dimension.
  10713. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10714. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10715. If one of the values is -1, the zscale filter will use a value that
  10716. maintains the aspect ratio of the input image, calculated from the
  10717. other specified dimension. If both of them are -1, the input size is
  10718. used
  10719. If one of the values is -n with n > 1, the zscale filter will also use a value
  10720. that maintains the aspect ratio of the input image, calculated from the other
  10721. specified dimension. After that it will, however, make sure that the calculated
  10722. dimension is divisible by n and adjust the value if necessary.
  10723. See below for the list of accepted constants for use in the dimension
  10724. expression.
  10725. @item size, s
  10726. Set the video size. For the syntax of this option, check the
  10727. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10728. @item dither, d
  10729. Set the dither type.
  10730. Possible values are:
  10731. @table @var
  10732. @item none
  10733. @item ordered
  10734. @item random
  10735. @item error_diffusion
  10736. @end table
  10737. Default is none.
  10738. @item filter, f
  10739. Set the resize filter type.
  10740. Possible values are:
  10741. @table @var
  10742. @item point
  10743. @item bilinear
  10744. @item bicubic
  10745. @item spline16
  10746. @item spline36
  10747. @item lanczos
  10748. @end table
  10749. Default is bilinear.
  10750. @item range, r
  10751. Set the color range.
  10752. Possible values are:
  10753. @table @var
  10754. @item input
  10755. @item limited
  10756. @item full
  10757. @end table
  10758. Default is same as input.
  10759. @item primaries, p
  10760. Set the color primaries.
  10761. Possible values are:
  10762. @table @var
  10763. @item input
  10764. @item 709
  10765. @item unspecified
  10766. @item 170m
  10767. @item 240m
  10768. @item 2020
  10769. @end table
  10770. Default is same as input.
  10771. @item transfer, t
  10772. Set the transfer characteristics.
  10773. Possible values are:
  10774. @table @var
  10775. @item input
  10776. @item 709
  10777. @item unspecified
  10778. @item 601
  10779. @item linear
  10780. @item 2020_10
  10781. @item 2020_12
  10782. @end table
  10783. Default is same as input.
  10784. @item matrix, m
  10785. Set the colorspace matrix.
  10786. Possible value are:
  10787. @table @var
  10788. @item input
  10789. @item 709
  10790. @item unspecified
  10791. @item 470bg
  10792. @item 170m
  10793. @item 2020_ncl
  10794. @item 2020_cl
  10795. @end table
  10796. Default is same as input.
  10797. @item rangein, rin
  10798. Set the input color range.
  10799. Possible values are:
  10800. @table @var
  10801. @item input
  10802. @item limited
  10803. @item full
  10804. @end table
  10805. Default is same as input.
  10806. @item primariesin, pin
  10807. Set the input color primaries.
  10808. Possible values are:
  10809. @table @var
  10810. @item input
  10811. @item 709
  10812. @item unspecified
  10813. @item 170m
  10814. @item 240m
  10815. @item 2020
  10816. @end table
  10817. Default is same as input.
  10818. @item transferin, tin
  10819. Set the input transfer characteristics.
  10820. Possible values are:
  10821. @table @var
  10822. @item input
  10823. @item 709
  10824. @item unspecified
  10825. @item 601
  10826. @item linear
  10827. @item 2020_10
  10828. @item 2020_12
  10829. @end table
  10830. Default is same as input.
  10831. @item matrixin, min
  10832. Set the input colorspace matrix.
  10833. Possible value are:
  10834. @table @var
  10835. @item input
  10836. @item 709
  10837. @item unspecified
  10838. @item 470bg
  10839. @item 170m
  10840. @item 2020_ncl
  10841. @item 2020_cl
  10842. @end table
  10843. @end table
  10844. The values of the @option{w} and @option{h} options are expressions
  10845. containing the following constants:
  10846. @table @var
  10847. @item in_w
  10848. @item in_h
  10849. The input width and height
  10850. @item iw
  10851. @item ih
  10852. These are the same as @var{in_w} and @var{in_h}.
  10853. @item out_w
  10854. @item out_h
  10855. The output (scaled) width and height
  10856. @item ow
  10857. @item oh
  10858. These are the same as @var{out_w} and @var{out_h}
  10859. @item a
  10860. The same as @var{iw} / @var{ih}
  10861. @item sar
  10862. input sample aspect ratio
  10863. @item dar
  10864. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10865. @item hsub
  10866. @item vsub
  10867. horizontal and vertical input chroma subsample values. For example for the
  10868. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10869. @item ohsub
  10870. @item ovsub
  10871. horizontal and vertical output chroma subsample values. For example for the
  10872. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10873. @end table
  10874. @table @option
  10875. @end table
  10876. @c man end VIDEO FILTERS
  10877. @chapter Video Sources
  10878. @c man begin VIDEO SOURCES
  10879. Below is a description of the currently available video sources.
  10880. @section buffer
  10881. Buffer video frames, and make them available to the filter chain.
  10882. This source is mainly intended for a programmatic use, in particular
  10883. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10884. It accepts the following parameters:
  10885. @table @option
  10886. @item video_size
  10887. Specify the size (width and height) of the buffered video frames. For the
  10888. syntax of this option, check the
  10889. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10890. @item width
  10891. The input video width.
  10892. @item height
  10893. The input video height.
  10894. @item pix_fmt
  10895. A string representing the pixel format of the buffered video frames.
  10896. It may be a number corresponding to a pixel format, or a pixel format
  10897. name.
  10898. @item time_base
  10899. Specify the timebase assumed by the timestamps of the buffered frames.
  10900. @item frame_rate
  10901. Specify the frame rate expected for the video stream.
  10902. @item pixel_aspect, sar
  10903. The sample (pixel) aspect ratio of the input video.
  10904. @item sws_param
  10905. Specify the optional parameters to be used for the scale filter which
  10906. is automatically inserted when an input change is detected in the
  10907. input size or format.
  10908. @item hw_frames_ctx
  10909. When using a hardware pixel format, this should be a reference to an
  10910. AVHWFramesContext describing input frames.
  10911. @end table
  10912. For example:
  10913. @example
  10914. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10915. @end example
  10916. will instruct the source to accept video frames with size 320x240 and
  10917. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10918. square pixels (1:1 sample aspect ratio).
  10919. Since the pixel format with name "yuv410p" corresponds to the number 6
  10920. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10921. this example corresponds to:
  10922. @example
  10923. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10924. @end example
  10925. Alternatively, the options can be specified as a flat string, but this
  10926. syntax is deprecated:
  10927. @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}]
  10928. @section cellauto
  10929. Create a pattern generated by an elementary cellular automaton.
  10930. The initial state of the cellular automaton can be defined through the
  10931. @option{filename} and @option{pattern} options. If such options are
  10932. not specified an initial state is created randomly.
  10933. At each new frame a new row in the video is filled with the result of
  10934. the cellular automaton next generation. The behavior when the whole
  10935. frame is filled is defined by the @option{scroll} option.
  10936. This source accepts the following options:
  10937. @table @option
  10938. @item filename, f
  10939. Read the initial cellular automaton state, i.e. the starting row, from
  10940. the specified file.
  10941. In the file, each non-whitespace character is considered an alive
  10942. cell, a newline will terminate the row, and further characters in the
  10943. file will be ignored.
  10944. @item pattern, p
  10945. Read the initial cellular automaton state, i.e. the starting row, from
  10946. the specified string.
  10947. Each non-whitespace character in the string is considered an alive
  10948. cell, a newline will terminate the row, and further characters in the
  10949. string will be ignored.
  10950. @item rate, r
  10951. Set the video rate, that is the number of frames generated per second.
  10952. Default is 25.
  10953. @item random_fill_ratio, ratio
  10954. Set the random fill ratio for the initial cellular automaton row. It
  10955. is a floating point number value ranging from 0 to 1, defaults to
  10956. 1/PHI.
  10957. This option is ignored when a file or a pattern is specified.
  10958. @item random_seed, seed
  10959. Set the seed for filling randomly the initial row, must be an integer
  10960. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10961. set to -1, the filter will try to use a good random seed on a best
  10962. effort basis.
  10963. @item rule
  10964. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10965. Default value is 110.
  10966. @item size, s
  10967. Set the size of the output video. For the syntax of this option, check the
  10968. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10969. If @option{filename} or @option{pattern} is specified, the size is set
  10970. by default to the width of the specified initial state row, and the
  10971. height is set to @var{width} * PHI.
  10972. If @option{size} is set, it must contain the width of the specified
  10973. pattern string, and the specified pattern will be centered in the
  10974. larger row.
  10975. If a filename or a pattern string is not specified, the size value
  10976. defaults to "320x518" (used for a randomly generated initial state).
  10977. @item scroll
  10978. If set to 1, scroll the output upward when all the rows in the output
  10979. have been already filled. If set to 0, the new generated row will be
  10980. written over the top row just after the bottom row is filled.
  10981. Defaults to 1.
  10982. @item start_full, full
  10983. If set to 1, completely fill the output with generated rows before
  10984. outputting the first frame.
  10985. This is the default behavior, for disabling set the value to 0.
  10986. @item stitch
  10987. If set to 1, stitch the left and right row edges together.
  10988. This is the default behavior, for disabling set the value to 0.
  10989. @end table
  10990. @subsection Examples
  10991. @itemize
  10992. @item
  10993. Read the initial state from @file{pattern}, and specify an output of
  10994. size 200x400.
  10995. @example
  10996. cellauto=f=pattern:s=200x400
  10997. @end example
  10998. @item
  10999. Generate a random initial row with a width of 200 cells, with a fill
  11000. ratio of 2/3:
  11001. @example
  11002. cellauto=ratio=2/3:s=200x200
  11003. @end example
  11004. @item
  11005. Create a pattern generated by rule 18 starting by a single alive cell
  11006. centered on an initial row with width 100:
  11007. @example
  11008. cellauto=p=@@:s=100x400:full=0:rule=18
  11009. @end example
  11010. @item
  11011. Specify a more elaborated initial pattern:
  11012. @example
  11013. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11014. @end example
  11015. @end itemize
  11016. @anchor{coreimagesrc}
  11017. @section coreimagesrc
  11018. Video source generated on GPU using Apple's CoreImage API on OSX.
  11019. This video source is a specialized version of the @ref{coreimage} video filter.
  11020. Use a core image generator at the beginning of the applied filterchain to
  11021. generate the content.
  11022. The coreimagesrc video source accepts the following options:
  11023. @table @option
  11024. @item list_generators
  11025. List all available generators along with all their respective options as well as
  11026. possible minimum and maximum values along with the default values.
  11027. @example
  11028. list_generators=true
  11029. @end example
  11030. @item size, s
  11031. Specify the size of the sourced video. For the syntax of this option, check the
  11032. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11033. The default value is @code{320x240}.
  11034. @item rate, r
  11035. Specify the frame rate of the sourced video, as the number of frames
  11036. generated per second. It has to be a string in the format
  11037. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11038. number or a valid video frame rate abbreviation. The default value is
  11039. "25".
  11040. @item sar
  11041. Set the sample aspect ratio of the sourced video.
  11042. @item duration, d
  11043. Set the duration of the sourced video. See
  11044. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11045. for the accepted syntax.
  11046. If not specified, or the expressed duration is negative, the video is
  11047. supposed to be generated forever.
  11048. @end table
  11049. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11050. A complete filterchain can be used for further processing of the
  11051. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11052. and examples for details.
  11053. @subsection Examples
  11054. @itemize
  11055. @item
  11056. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11057. given as complete and escaped command-line for Apple's standard bash shell:
  11058. @example
  11059. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11060. @end example
  11061. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11062. need for a nullsrc video source.
  11063. @end itemize
  11064. @section mandelbrot
  11065. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11066. point specified with @var{start_x} and @var{start_y}.
  11067. This source accepts the following options:
  11068. @table @option
  11069. @item end_pts
  11070. Set the terminal pts value. Default value is 400.
  11071. @item end_scale
  11072. Set the terminal scale value.
  11073. Must be a floating point value. Default value is 0.3.
  11074. @item inner
  11075. Set the inner coloring mode, that is the algorithm used to draw the
  11076. Mandelbrot fractal internal region.
  11077. It shall assume one of the following values:
  11078. @table @option
  11079. @item black
  11080. Set black mode.
  11081. @item convergence
  11082. Show time until convergence.
  11083. @item mincol
  11084. Set color based on point closest to the origin of the iterations.
  11085. @item period
  11086. Set period mode.
  11087. @end table
  11088. Default value is @var{mincol}.
  11089. @item bailout
  11090. Set the bailout value. Default value is 10.0.
  11091. @item maxiter
  11092. Set the maximum of iterations performed by the rendering
  11093. algorithm. Default value is 7189.
  11094. @item outer
  11095. Set outer coloring mode.
  11096. It shall assume one of following values:
  11097. @table @option
  11098. @item iteration_count
  11099. Set iteration cound mode.
  11100. @item normalized_iteration_count
  11101. set normalized iteration count mode.
  11102. @end table
  11103. Default value is @var{normalized_iteration_count}.
  11104. @item rate, r
  11105. Set frame rate, expressed as number of frames per second. Default
  11106. value is "25".
  11107. @item size, s
  11108. Set frame size. For the syntax of this option, check the "Video
  11109. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11110. @item start_scale
  11111. Set the initial scale value. Default value is 3.0.
  11112. @item start_x
  11113. Set the initial x position. Must be a floating point value between
  11114. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11115. @item start_y
  11116. Set the initial y position. Must be a floating point value between
  11117. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11118. @end table
  11119. @section mptestsrc
  11120. Generate various test patterns, as generated by the MPlayer test filter.
  11121. The size of the generated video is fixed, and is 256x256.
  11122. This source is useful in particular for testing encoding features.
  11123. This source accepts the following options:
  11124. @table @option
  11125. @item rate, r
  11126. Specify the frame rate of the sourced video, as the number of frames
  11127. generated per second. It has to be a string in the format
  11128. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11129. number or a valid video frame rate abbreviation. The default value is
  11130. "25".
  11131. @item duration, d
  11132. Set the duration of the sourced video. See
  11133. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11134. for the accepted syntax.
  11135. If not specified, or the expressed duration is negative, the video is
  11136. supposed to be generated forever.
  11137. @item test, t
  11138. Set the number or the name of the test to perform. Supported tests are:
  11139. @table @option
  11140. @item dc_luma
  11141. @item dc_chroma
  11142. @item freq_luma
  11143. @item freq_chroma
  11144. @item amp_luma
  11145. @item amp_chroma
  11146. @item cbp
  11147. @item mv
  11148. @item ring1
  11149. @item ring2
  11150. @item all
  11151. @end table
  11152. Default value is "all", which will cycle through the list of all tests.
  11153. @end table
  11154. Some examples:
  11155. @example
  11156. mptestsrc=t=dc_luma
  11157. @end example
  11158. will generate a "dc_luma" test pattern.
  11159. @section frei0r_src
  11160. Provide a frei0r source.
  11161. To enable compilation of this filter you need to install the frei0r
  11162. header and configure FFmpeg with @code{--enable-frei0r}.
  11163. This source accepts the following parameters:
  11164. @table @option
  11165. @item size
  11166. The size of the video to generate. For the syntax of this option, check the
  11167. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11168. @item framerate
  11169. The framerate of the generated video. It may be a string of the form
  11170. @var{num}/@var{den} or a frame rate abbreviation.
  11171. @item filter_name
  11172. The name to the frei0r source to load. For more information regarding frei0r and
  11173. how to set the parameters, read the @ref{frei0r} section in the video filters
  11174. documentation.
  11175. @item filter_params
  11176. A '|'-separated list of parameters to pass to the frei0r source.
  11177. @end table
  11178. For example, to generate a frei0r partik0l source with size 200x200
  11179. and frame rate 10 which is overlaid on the overlay filter main input:
  11180. @example
  11181. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11182. @end example
  11183. @section life
  11184. Generate a life pattern.
  11185. This source is based on a generalization of John Conway's life game.
  11186. The sourced input represents a life grid, each pixel represents a cell
  11187. which can be in one of two possible states, alive or dead. Every cell
  11188. interacts with its eight neighbours, which are the cells that are
  11189. horizontally, vertically, or diagonally adjacent.
  11190. At each interaction the grid evolves according to the adopted rule,
  11191. which specifies the number of neighbor alive cells which will make a
  11192. cell stay alive or born. The @option{rule} option allows one to specify
  11193. the rule to adopt.
  11194. This source accepts the following options:
  11195. @table @option
  11196. @item filename, f
  11197. Set the file from which to read the initial grid state. In the file,
  11198. each non-whitespace character is considered an alive cell, and newline
  11199. is used to delimit the end of each row.
  11200. If this option is not specified, the initial grid is generated
  11201. randomly.
  11202. @item rate, r
  11203. Set the video rate, that is the number of frames generated per second.
  11204. Default is 25.
  11205. @item random_fill_ratio, ratio
  11206. Set the random fill ratio for the initial random grid. It is a
  11207. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11208. It is ignored when a file is specified.
  11209. @item random_seed, seed
  11210. Set the seed for filling the initial random grid, must be an integer
  11211. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11212. set to -1, the filter will try to use a good random seed on a best
  11213. effort basis.
  11214. @item rule
  11215. Set the life rule.
  11216. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11217. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11218. @var{NS} specifies the number of alive neighbor cells which make a
  11219. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11220. which make a dead cell to become alive (i.e. to "born").
  11221. "s" and "b" can be used in place of "S" and "B", respectively.
  11222. Alternatively a rule can be specified by an 18-bits integer. The 9
  11223. high order bits are used to encode the next cell state if it is alive
  11224. for each number of neighbor alive cells, the low order bits specify
  11225. the rule for "borning" new cells. Higher order bits encode for an
  11226. higher number of neighbor cells.
  11227. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11228. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11229. Default value is "S23/B3", which is the original Conway's game of life
  11230. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11231. cells, and will born a new cell if there are three alive cells around
  11232. a dead cell.
  11233. @item size, s
  11234. Set the size of the output video. For the syntax of this option, check the
  11235. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11236. If @option{filename} is specified, the size is set by default to the
  11237. same size of the input file. If @option{size} is set, it must contain
  11238. the size specified in the input file, and the initial grid defined in
  11239. that file is centered in the larger resulting area.
  11240. If a filename is not specified, the size value defaults to "320x240"
  11241. (used for a randomly generated initial grid).
  11242. @item stitch
  11243. If set to 1, stitch the left and right grid edges together, and the
  11244. top and bottom edges also. Defaults to 1.
  11245. @item mold
  11246. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11247. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11248. value from 0 to 255.
  11249. @item life_color
  11250. Set the color of living (or new born) cells.
  11251. @item death_color
  11252. Set the color of dead cells. If @option{mold} is set, this is the first color
  11253. used to represent a dead cell.
  11254. @item mold_color
  11255. Set mold color, for definitely dead and moldy cells.
  11256. For the syntax of these 3 color options, check the "Color" section in the
  11257. ffmpeg-utils manual.
  11258. @end table
  11259. @subsection Examples
  11260. @itemize
  11261. @item
  11262. Read a grid from @file{pattern}, and center it on a grid of size
  11263. 300x300 pixels:
  11264. @example
  11265. life=f=pattern:s=300x300
  11266. @end example
  11267. @item
  11268. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11269. @example
  11270. life=ratio=2/3:s=200x200
  11271. @end example
  11272. @item
  11273. Specify a custom rule for evolving a randomly generated grid:
  11274. @example
  11275. life=rule=S14/B34
  11276. @end example
  11277. @item
  11278. Full example with slow death effect (mold) using @command{ffplay}:
  11279. @example
  11280. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11281. @end example
  11282. @end itemize
  11283. @anchor{allrgb}
  11284. @anchor{allyuv}
  11285. @anchor{color}
  11286. @anchor{haldclutsrc}
  11287. @anchor{nullsrc}
  11288. @anchor{rgbtestsrc}
  11289. @anchor{smptebars}
  11290. @anchor{smptehdbars}
  11291. @anchor{testsrc}
  11292. @anchor{testsrc2}
  11293. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
  11294. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11295. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11296. The @code{color} source provides an uniformly colored input.
  11297. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11298. @ref{haldclut} filter.
  11299. The @code{nullsrc} source returns unprocessed video frames. It is
  11300. mainly useful to be employed in analysis / debugging tools, or as the
  11301. source for filters which ignore the input data.
  11302. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11303. detecting RGB vs BGR issues. You should see a red, green and blue
  11304. stripe from top to bottom.
  11305. The @code{smptebars} source generates a color bars pattern, based on
  11306. the SMPTE Engineering Guideline EG 1-1990.
  11307. The @code{smptehdbars} source generates a color bars pattern, based on
  11308. the SMPTE RP 219-2002.
  11309. The @code{testsrc} source generates a test video pattern, showing a
  11310. color pattern, a scrolling gradient and a timestamp. This is mainly
  11311. intended for testing purposes.
  11312. The @code{testsrc2} source is similar to testsrc, but supports more
  11313. pixel formats instead of just @code{rgb24}. This allows using it as an
  11314. input for other tests without requiring a format conversion.
  11315. The sources accept the following parameters:
  11316. @table @option
  11317. @item color, c
  11318. Specify the color of the source, only available in the @code{color}
  11319. source. For the syntax of this option, check the "Color" section in the
  11320. ffmpeg-utils manual.
  11321. @item level
  11322. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11323. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11324. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11325. coded on a @code{1/(N*N)} scale.
  11326. @item size, s
  11327. Specify the size of the sourced video. For the syntax of this option, check the
  11328. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11329. The default value is @code{320x240}.
  11330. This option is not available with the @code{haldclutsrc} filter.
  11331. @item rate, r
  11332. Specify the frame rate of the sourced video, as the number of frames
  11333. generated per second. It has to be a string in the format
  11334. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11335. number or a valid video frame rate abbreviation. The default value is
  11336. "25".
  11337. @item sar
  11338. Set the sample aspect ratio of the sourced video.
  11339. @item duration, d
  11340. Set the duration of the sourced video. See
  11341. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11342. for the accepted syntax.
  11343. If not specified, or the expressed duration is negative, the video is
  11344. supposed to be generated forever.
  11345. @item decimals, n
  11346. Set the number of decimals to show in the timestamp, only available in the
  11347. @code{testsrc} source.
  11348. The displayed timestamp value will correspond to the original
  11349. timestamp value multiplied by the power of 10 of the specified
  11350. value. Default value is 0.
  11351. @end table
  11352. For example the following:
  11353. @example
  11354. testsrc=duration=5.3:size=qcif:rate=10
  11355. @end example
  11356. will generate a video with a duration of 5.3 seconds, with size
  11357. 176x144 and a frame rate of 10 frames per second.
  11358. The following graph description will generate a red source
  11359. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11360. frames per second.
  11361. @example
  11362. color=c=red@@0.2:s=qcif:r=10
  11363. @end example
  11364. If the input content is to be ignored, @code{nullsrc} can be used. The
  11365. following command generates noise in the luminance plane by employing
  11366. the @code{geq} filter:
  11367. @example
  11368. nullsrc=s=256x256, geq=random(1)*255:128:128
  11369. @end example
  11370. @subsection Commands
  11371. The @code{color} source supports the following commands:
  11372. @table @option
  11373. @item c, color
  11374. Set the color of the created image. Accepts the same syntax of the
  11375. corresponding @option{color} option.
  11376. @end table
  11377. @c man end VIDEO SOURCES
  11378. @chapter Video Sinks
  11379. @c man begin VIDEO SINKS
  11380. Below is a description of the currently available video sinks.
  11381. @section buffersink
  11382. Buffer video frames, and make them available to the end of the filter
  11383. graph.
  11384. This sink is mainly intended for programmatic use, in particular
  11385. through the interface defined in @file{libavfilter/buffersink.h}
  11386. or the options system.
  11387. It accepts a pointer to an AVBufferSinkContext structure, which
  11388. defines the incoming buffers' formats, to be passed as the opaque
  11389. parameter to @code{avfilter_init_filter} for initialization.
  11390. @section nullsink
  11391. Null video sink: do absolutely nothing with the input video. It is
  11392. mainly useful as a template and for use in analysis / debugging
  11393. tools.
  11394. @c man end VIDEO SINKS
  11395. @chapter Multimedia Filters
  11396. @c man begin MULTIMEDIA FILTERS
  11397. Below is a description of the currently available multimedia filters.
  11398. @section ahistogram
  11399. Convert input audio to a video output, displaying the volume histogram.
  11400. The filter accepts the following options:
  11401. @table @option
  11402. @item dmode
  11403. Specify how histogram is calculated.
  11404. It accepts the following values:
  11405. @table @samp
  11406. @item single
  11407. Use single histogram for all channels.
  11408. @item separate
  11409. Use separate histogram for each channel.
  11410. @end table
  11411. Default is @code{single}.
  11412. @item rate, r
  11413. Set frame rate, expressed as number of frames per second. Default
  11414. value is "25".
  11415. @item size, s
  11416. Specify the video size for the output. For the syntax of this option, check the
  11417. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11418. Default value is @code{hd720}.
  11419. @item scale
  11420. Set display scale.
  11421. It accepts the following values:
  11422. @table @samp
  11423. @item log
  11424. logarithmic
  11425. @item sqrt
  11426. square root
  11427. @item cbrt
  11428. cubic root
  11429. @item lin
  11430. linear
  11431. @item rlog
  11432. reverse logarithmic
  11433. @end table
  11434. Default is @code{log}.
  11435. @item ascale
  11436. Set amplitude scale.
  11437. It accepts the following values:
  11438. @table @samp
  11439. @item log
  11440. logarithmic
  11441. @item lin
  11442. linear
  11443. @end table
  11444. Default is @code{log}.
  11445. @item acount
  11446. Set how much frames to accumulate in histogram.
  11447. Defauls is 1. Setting this to -1 accumulates all frames.
  11448. @item rheight
  11449. Set histogram ratio of window height.
  11450. @item slide
  11451. Set sonogram sliding.
  11452. It accepts the following values:
  11453. @table @samp
  11454. @item replace
  11455. replace old rows with new ones.
  11456. @item scroll
  11457. scroll from top to bottom.
  11458. @end table
  11459. Default is @code{replace}.
  11460. @end table
  11461. @section aphasemeter
  11462. Convert input audio to a video output, displaying the audio phase.
  11463. The filter accepts the following options:
  11464. @table @option
  11465. @item rate, r
  11466. Set the output frame rate. Default value is @code{25}.
  11467. @item size, s
  11468. Set the video size for the output. For the syntax of this option, check the
  11469. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11470. Default value is @code{800x400}.
  11471. @item rc
  11472. @item gc
  11473. @item bc
  11474. Specify the red, green, blue contrast. Default values are @code{2},
  11475. @code{7} and @code{1}.
  11476. Allowed range is @code{[0, 255]}.
  11477. @item mpc
  11478. Set color which will be used for drawing median phase. If color is
  11479. @code{none} which is default, no median phase value will be drawn.
  11480. @end table
  11481. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11482. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11483. The @code{-1} means left and right channels are completely out of phase and
  11484. @code{1} means channels are in phase.
  11485. @section avectorscope
  11486. Convert input audio to a video output, representing the audio vector
  11487. scope.
  11488. The filter is used to measure the difference between channels of stereo
  11489. audio stream. A monoaural signal, consisting of identical left and right
  11490. signal, results in straight vertical line. Any stereo separation is visible
  11491. as a deviation from this line, creating a Lissajous figure.
  11492. If the straight (or deviation from it) but horizontal line appears this
  11493. indicates that the left and right channels are out of phase.
  11494. The filter accepts the following options:
  11495. @table @option
  11496. @item mode, m
  11497. Set the vectorscope mode.
  11498. Available values are:
  11499. @table @samp
  11500. @item lissajous
  11501. Lissajous rotated by 45 degrees.
  11502. @item lissajous_xy
  11503. Same as above but not rotated.
  11504. @item polar
  11505. Shape resembling half of circle.
  11506. @end table
  11507. Default value is @samp{lissajous}.
  11508. @item size, s
  11509. Set the video size for the output. For the syntax of this option, check the
  11510. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11511. Default value is @code{400x400}.
  11512. @item rate, r
  11513. Set the output frame rate. Default value is @code{25}.
  11514. @item rc
  11515. @item gc
  11516. @item bc
  11517. @item ac
  11518. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11519. @code{160}, @code{80} and @code{255}.
  11520. Allowed range is @code{[0, 255]}.
  11521. @item rf
  11522. @item gf
  11523. @item bf
  11524. @item af
  11525. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11526. @code{10}, @code{5} and @code{5}.
  11527. Allowed range is @code{[0, 255]}.
  11528. @item zoom
  11529. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11530. @item draw
  11531. Set the vectorscope drawing mode.
  11532. Available values are:
  11533. @table @samp
  11534. @item dot
  11535. Draw dot for each sample.
  11536. @item line
  11537. Draw line between previous and current sample.
  11538. @end table
  11539. Default value is @samp{dot}.
  11540. @end table
  11541. @subsection Examples
  11542. @itemize
  11543. @item
  11544. Complete example using @command{ffplay}:
  11545. @example
  11546. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11547. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11548. @end example
  11549. @end itemize
  11550. @section bench, abench
  11551. Benchmark part of a filtergraph.
  11552. The filter accepts the following options:
  11553. @table @option
  11554. @item action
  11555. Start or stop a timer.
  11556. Available values are:
  11557. @table @samp
  11558. @item start
  11559. Get the current time, set it as frame metadata (using the key
  11560. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11561. @item stop
  11562. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11563. the input frame metadata to get the time difference. Time difference, average,
  11564. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11565. @code{min}) are then printed. The timestamps are expressed in seconds.
  11566. @end table
  11567. @end table
  11568. @subsection Examples
  11569. @itemize
  11570. @item
  11571. Benchmark @ref{selectivecolor} filter:
  11572. @example
  11573. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11574. @end example
  11575. @end itemize
  11576. @section concat
  11577. Concatenate audio and video streams, joining them together one after the
  11578. other.
  11579. The filter works on segments of synchronized video and audio streams. All
  11580. segments must have the same number of streams of each type, and that will
  11581. also be the number of streams at output.
  11582. The filter accepts the following options:
  11583. @table @option
  11584. @item n
  11585. Set the number of segments. Default is 2.
  11586. @item v
  11587. Set the number of output video streams, that is also the number of video
  11588. streams in each segment. Default is 1.
  11589. @item a
  11590. Set the number of output audio streams, that is also the number of audio
  11591. streams in each segment. Default is 0.
  11592. @item unsafe
  11593. Activate unsafe mode: do not fail if segments have a different format.
  11594. @end table
  11595. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11596. @var{a} audio outputs.
  11597. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11598. segment, in the same order as the outputs, then the inputs for the second
  11599. segment, etc.
  11600. Related streams do not always have exactly the same duration, for various
  11601. reasons including codec frame size or sloppy authoring. For that reason,
  11602. related synchronized streams (e.g. a video and its audio track) should be
  11603. concatenated at once. The concat filter will use the duration of the longest
  11604. stream in each segment (except the last one), and if necessary pad shorter
  11605. audio streams with silence.
  11606. For this filter to work correctly, all segments must start at timestamp 0.
  11607. All corresponding streams must have the same parameters in all segments; the
  11608. filtering system will automatically select a common pixel format for video
  11609. streams, and a common sample format, sample rate and channel layout for
  11610. audio streams, but other settings, such as resolution, must be converted
  11611. explicitly by the user.
  11612. Different frame rates are acceptable but will result in variable frame rate
  11613. at output; be sure to configure the output file to handle it.
  11614. @subsection Examples
  11615. @itemize
  11616. @item
  11617. Concatenate an opening, an episode and an ending, all in bilingual version
  11618. (video in stream 0, audio in streams 1 and 2):
  11619. @example
  11620. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11621. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11622. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11623. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11624. @end example
  11625. @item
  11626. Concatenate two parts, handling audio and video separately, using the
  11627. (a)movie sources, and adjusting the resolution:
  11628. @example
  11629. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11630. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11631. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11632. @end example
  11633. Note that a desync will happen at the stitch if the audio and video streams
  11634. do not have exactly the same duration in the first file.
  11635. @end itemize
  11636. @anchor{ebur128}
  11637. @section ebur128
  11638. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11639. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11640. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11641. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11642. The filter also has a video output (see the @var{video} option) with a real
  11643. time graph to observe the loudness evolution. The graphic contains the logged
  11644. message mentioned above, so it is not printed anymore when this option is set,
  11645. unless the verbose logging is set. The main graphing area contains the
  11646. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11647. the momentary loudness (400 milliseconds).
  11648. More information about the Loudness Recommendation EBU R128 on
  11649. @url{http://tech.ebu.ch/loudness}.
  11650. The filter accepts the following options:
  11651. @table @option
  11652. @item video
  11653. Activate the video output. The audio stream is passed unchanged whether this
  11654. option is set or no. The video stream will be the first output stream if
  11655. activated. Default is @code{0}.
  11656. @item size
  11657. Set the video size. This option is for video only. For the syntax of this
  11658. option, check the
  11659. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11660. Default and minimum resolution is @code{640x480}.
  11661. @item meter
  11662. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11663. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11664. other integer value between this range is allowed.
  11665. @item metadata
  11666. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11667. into 100ms output frames, each of them containing various loudness information
  11668. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11669. Default is @code{0}.
  11670. @item framelog
  11671. Force the frame logging level.
  11672. Available values are:
  11673. @table @samp
  11674. @item info
  11675. information logging level
  11676. @item verbose
  11677. verbose logging level
  11678. @end table
  11679. By default, the logging level is set to @var{info}. If the @option{video} or
  11680. the @option{metadata} options are set, it switches to @var{verbose}.
  11681. @item peak
  11682. Set peak mode(s).
  11683. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11684. values are:
  11685. @table @samp
  11686. @item none
  11687. Disable any peak mode (default).
  11688. @item sample
  11689. Enable sample-peak mode.
  11690. Simple peak mode looking for the higher sample value. It logs a message
  11691. for sample-peak (identified by @code{SPK}).
  11692. @item true
  11693. Enable true-peak mode.
  11694. If enabled, the peak lookup is done on an over-sampled version of the input
  11695. stream for better peak accuracy. It logs a message for true-peak.
  11696. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11697. This mode requires a build with @code{libswresample}.
  11698. @end table
  11699. @item dualmono
  11700. Treat mono input files as "dual mono". If a mono file is intended for playback
  11701. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11702. If set to @code{true}, this option will compensate for this effect.
  11703. Multi-channel input files are not affected by this option.
  11704. @item panlaw
  11705. Set a specific pan law to be used for the measurement of dual mono files.
  11706. This parameter is optional, and has a default value of -3.01dB.
  11707. @end table
  11708. @subsection Examples
  11709. @itemize
  11710. @item
  11711. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11712. @example
  11713. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11714. @end example
  11715. @item
  11716. Run an analysis with @command{ffmpeg}:
  11717. @example
  11718. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11719. @end example
  11720. @end itemize
  11721. @section interleave, ainterleave
  11722. Temporally interleave frames from several inputs.
  11723. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11724. These filters read frames from several inputs and send the oldest
  11725. queued frame to the output.
  11726. Input streams must have well defined, monotonically increasing frame
  11727. timestamp values.
  11728. In order to submit one frame to output, these filters need to enqueue
  11729. at least one frame for each input, so they cannot work in case one
  11730. input is not yet terminated and will not receive incoming frames.
  11731. For example consider the case when one input is a @code{select} filter
  11732. which always drops input frames. The @code{interleave} filter will keep
  11733. reading from that input, but it will never be able to send new frames
  11734. to output until the input sends an end-of-stream signal.
  11735. Also, depending on inputs synchronization, the filters will drop
  11736. frames in case one input receives more frames than the other ones, and
  11737. the queue is already filled.
  11738. These filters accept the following options:
  11739. @table @option
  11740. @item nb_inputs, n
  11741. Set the number of different inputs, it is 2 by default.
  11742. @end table
  11743. @subsection Examples
  11744. @itemize
  11745. @item
  11746. Interleave frames belonging to different streams using @command{ffmpeg}:
  11747. @example
  11748. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11749. @end example
  11750. @item
  11751. Add flickering blur effect:
  11752. @example
  11753. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11754. @end example
  11755. @end itemize
  11756. @section perms, aperms
  11757. Set read/write permissions for the output frames.
  11758. These filters are mainly aimed at developers to test direct path in the
  11759. following filter in the filtergraph.
  11760. The filters accept the following options:
  11761. @table @option
  11762. @item mode
  11763. Select the permissions mode.
  11764. It accepts the following values:
  11765. @table @samp
  11766. @item none
  11767. Do nothing. This is the default.
  11768. @item ro
  11769. Set all the output frames read-only.
  11770. @item rw
  11771. Set all the output frames directly writable.
  11772. @item toggle
  11773. Make the frame read-only if writable, and writable if read-only.
  11774. @item random
  11775. Set each output frame read-only or writable randomly.
  11776. @end table
  11777. @item seed
  11778. Set the seed for the @var{random} mode, must be an integer included between
  11779. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11780. @code{-1}, the filter will try to use a good random seed on a best effort
  11781. basis.
  11782. @end table
  11783. Note: in case of auto-inserted filter between the permission filter and the
  11784. following one, the permission might not be received as expected in that
  11785. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11786. perms/aperms filter can avoid this problem.
  11787. @section realtime, arealtime
  11788. Slow down filtering to match real time approximatively.
  11789. These filters will pause the filtering for a variable amount of time to
  11790. match the output rate with the input timestamps.
  11791. They are similar to the @option{re} option to @code{ffmpeg}.
  11792. They accept the following options:
  11793. @table @option
  11794. @item limit
  11795. Time limit for the pauses. Any pause longer than that will be considered
  11796. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11797. @end table
  11798. @section select, aselect
  11799. Select frames to pass in output.
  11800. This filter accepts the following options:
  11801. @table @option
  11802. @item expr, e
  11803. Set expression, which is evaluated for each input frame.
  11804. If the expression is evaluated to zero, the frame is discarded.
  11805. If the evaluation result is negative or NaN, the frame is sent to the
  11806. first output; otherwise it is sent to the output with index
  11807. @code{ceil(val)-1}, assuming that the input index starts from 0.
  11808. For example a value of @code{1.2} corresponds to the output with index
  11809. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  11810. @item outputs, n
  11811. Set the number of outputs. The output to which to send the selected
  11812. frame is based on the result of the evaluation. Default value is 1.
  11813. @end table
  11814. The expression can contain the following constants:
  11815. @table @option
  11816. @item n
  11817. The (sequential) number of the filtered frame, starting from 0.
  11818. @item selected_n
  11819. The (sequential) number of the selected frame, starting from 0.
  11820. @item prev_selected_n
  11821. The sequential number of the last selected frame. It's NAN if undefined.
  11822. @item TB
  11823. The timebase of the input timestamps.
  11824. @item pts
  11825. The PTS (Presentation TimeStamp) of the filtered video frame,
  11826. expressed in @var{TB} units. It's NAN if undefined.
  11827. @item t
  11828. The PTS of the filtered video frame,
  11829. expressed in seconds. It's NAN if undefined.
  11830. @item prev_pts
  11831. The PTS of the previously filtered video frame. It's NAN if undefined.
  11832. @item prev_selected_pts
  11833. The PTS of the last previously filtered video frame. It's NAN if undefined.
  11834. @item prev_selected_t
  11835. The PTS of the last previously selected video frame. It's NAN if undefined.
  11836. @item start_pts
  11837. The PTS of the first video frame in the video. It's NAN if undefined.
  11838. @item start_t
  11839. The time of the first video frame in the video. It's NAN if undefined.
  11840. @item pict_type @emph{(video only)}
  11841. The type of the filtered frame. It can assume one of the following
  11842. values:
  11843. @table @option
  11844. @item I
  11845. @item P
  11846. @item B
  11847. @item S
  11848. @item SI
  11849. @item SP
  11850. @item BI
  11851. @end table
  11852. @item interlace_type @emph{(video only)}
  11853. The frame interlace type. It can assume one of the following values:
  11854. @table @option
  11855. @item PROGRESSIVE
  11856. The frame is progressive (not interlaced).
  11857. @item TOPFIRST
  11858. The frame is top-field-first.
  11859. @item BOTTOMFIRST
  11860. The frame is bottom-field-first.
  11861. @end table
  11862. @item consumed_sample_n @emph{(audio only)}
  11863. the number of selected samples before the current frame
  11864. @item samples_n @emph{(audio only)}
  11865. the number of samples in the current frame
  11866. @item sample_rate @emph{(audio only)}
  11867. the input sample rate
  11868. @item key
  11869. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  11870. @item pos
  11871. the position in the file of the filtered frame, -1 if the information
  11872. is not available (e.g. for synthetic video)
  11873. @item scene @emph{(video only)}
  11874. value between 0 and 1 to indicate a new scene; a low value reflects a low
  11875. probability for the current frame to introduce a new scene, while a higher
  11876. value means the current frame is more likely to be one (see the example below)
  11877. @item concatdec_select
  11878. The concat demuxer can select only part of a concat input file by setting an
  11879. inpoint and an outpoint, but the output packets may not be entirely contained
  11880. in the selected interval. By using this variable, it is possible to skip frames
  11881. generated by the concat demuxer which are not exactly contained in the selected
  11882. interval.
  11883. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  11884. and the @var{lavf.concat.duration} packet metadata values which are also
  11885. present in the decoded frames.
  11886. The @var{concatdec_select} variable is -1 if the frame pts is at least
  11887. start_time and either the duration metadata is missing or the frame pts is less
  11888. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  11889. missing.
  11890. That basically means that an input frame is selected if its pts is within the
  11891. interval set by the concat demuxer.
  11892. @end table
  11893. The default value of the select expression is "1".
  11894. @subsection Examples
  11895. @itemize
  11896. @item
  11897. Select all frames in input:
  11898. @example
  11899. select
  11900. @end example
  11901. The example above is the same as:
  11902. @example
  11903. select=1
  11904. @end example
  11905. @item
  11906. Skip all frames:
  11907. @example
  11908. select=0
  11909. @end example
  11910. @item
  11911. Select only I-frames:
  11912. @example
  11913. select='eq(pict_type\,I)'
  11914. @end example
  11915. @item
  11916. Select one frame every 100:
  11917. @example
  11918. select='not(mod(n\,100))'
  11919. @end example
  11920. @item
  11921. Select only frames contained in the 10-20 time interval:
  11922. @example
  11923. select=between(t\,10\,20)
  11924. @end example
  11925. @item
  11926. Select only I-frames contained in the 10-20 time interval:
  11927. @example
  11928. select=between(t\,10\,20)*eq(pict_type\,I)
  11929. @end example
  11930. @item
  11931. Select frames with a minimum distance of 10 seconds:
  11932. @example
  11933. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  11934. @end example
  11935. @item
  11936. Use aselect to select only audio frames with samples number > 100:
  11937. @example
  11938. aselect='gt(samples_n\,100)'
  11939. @end example
  11940. @item
  11941. Create a mosaic of the first scenes:
  11942. @example
  11943. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  11944. @end example
  11945. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  11946. choice.
  11947. @item
  11948. Send even and odd frames to separate outputs, and compose them:
  11949. @example
  11950. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  11951. @end example
  11952. @item
  11953. Select useful frames from an ffconcat file which is using inpoints and
  11954. outpoints but where the source files are not intra frame only.
  11955. @example
  11956. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  11957. @end example
  11958. @end itemize
  11959. @section sendcmd, asendcmd
  11960. Send commands to filters in the filtergraph.
  11961. These filters read commands to be sent to other filters in the
  11962. filtergraph.
  11963. @code{sendcmd} must be inserted between two video filters,
  11964. @code{asendcmd} must be inserted between two audio filters, but apart
  11965. from that they act the same way.
  11966. The specification of commands can be provided in the filter arguments
  11967. with the @var{commands} option, or in a file specified by the
  11968. @var{filename} option.
  11969. These filters accept the following options:
  11970. @table @option
  11971. @item commands, c
  11972. Set the commands to be read and sent to the other filters.
  11973. @item filename, f
  11974. Set the filename of the commands to be read and sent to the other
  11975. filters.
  11976. @end table
  11977. @subsection Commands syntax
  11978. A commands description consists of a sequence of interval
  11979. specifications, comprising a list of commands to be executed when a
  11980. particular event related to that interval occurs. The occurring event
  11981. is typically the current frame time entering or leaving a given time
  11982. interval.
  11983. An interval is specified by the following syntax:
  11984. @example
  11985. @var{START}[-@var{END}] @var{COMMANDS};
  11986. @end example
  11987. The time interval is specified by the @var{START} and @var{END} times.
  11988. @var{END} is optional and defaults to the maximum time.
  11989. The current frame time is considered within the specified interval if
  11990. it is included in the interval [@var{START}, @var{END}), that is when
  11991. the time is greater or equal to @var{START} and is lesser than
  11992. @var{END}.
  11993. @var{COMMANDS} consists of a sequence of one or more command
  11994. specifications, separated by ",", relating to that interval. The
  11995. syntax of a command specification is given by:
  11996. @example
  11997. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  11998. @end example
  11999. @var{FLAGS} is optional and specifies the type of events relating to
  12000. the time interval which enable sending the specified command, and must
  12001. be a non-null sequence of identifier flags separated by "+" or "|" and
  12002. enclosed between "[" and "]".
  12003. The following flags are recognized:
  12004. @table @option
  12005. @item enter
  12006. The command is sent when the current frame timestamp enters the
  12007. specified interval. In other words, the command is sent when the
  12008. previous frame timestamp was not in the given interval, and the
  12009. current is.
  12010. @item leave
  12011. The command is sent when the current frame timestamp leaves the
  12012. specified interval. In other words, the command is sent when the
  12013. previous frame timestamp was in the given interval, and the
  12014. current is not.
  12015. @end table
  12016. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12017. assumed.
  12018. @var{TARGET} specifies the target of the command, usually the name of
  12019. the filter class or a specific filter instance name.
  12020. @var{COMMAND} specifies the name of the command for the target filter.
  12021. @var{ARG} is optional and specifies the optional list of argument for
  12022. the given @var{COMMAND}.
  12023. Between one interval specification and another, whitespaces, or
  12024. sequences of characters starting with @code{#} until the end of line,
  12025. are ignored and can be used to annotate comments.
  12026. A simplified BNF description of the commands specification syntax
  12027. follows:
  12028. @example
  12029. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12030. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12031. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12032. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12033. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12034. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12035. @end example
  12036. @subsection Examples
  12037. @itemize
  12038. @item
  12039. Specify audio tempo change at second 4:
  12040. @example
  12041. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12042. @end example
  12043. @item
  12044. Specify a list of drawtext and hue commands in a file.
  12045. @example
  12046. # show text in the interval 5-10
  12047. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12048. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12049. # desaturate the image in the interval 15-20
  12050. 15.0-20.0 [enter] hue s 0,
  12051. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12052. [leave] hue s 1,
  12053. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12054. # apply an exponential saturation fade-out effect, starting from time 25
  12055. 25 [enter] hue s exp(25-t)
  12056. @end example
  12057. A filtergraph allowing to read and process the above command list
  12058. stored in a file @file{test.cmd}, can be specified with:
  12059. @example
  12060. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12061. @end example
  12062. @end itemize
  12063. @anchor{setpts}
  12064. @section setpts, asetpts
  12065. Change the PTS (presentation timestamp) of the input frames.
  12066. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12067. This filter accepts the following options:
  12068. @table @option
  12069. @item expr
  12070. The expression which is evaluated for each frame to construct its timestamp.
  12071. @end table
  12072. The expression is evaluated through the eval API and can contain the following
  12073. constants:
  12074. @table @option
  12075. @item FRAME_RATE
  12076. frame rate, only defined for constant frame-rate video
  12077. @item PTS
  12078. The presentation timestamp in input
  12079. @item N
  12080. The count of the input frame for video or the number of consumed samples,
  12081. not including the current frame for audio, starting from 0.
  12082. @item NB_CONSUMED_SAMPLES
  12083. The number of consumed samples, not including the current frame (only
  12084. audio)
  12085. @item NB_SAMPLES, S
  12086. The number of samples in the current frame (only audio)
  12087. @item SAMPLE_RATE, SR
  12088. The audio sample rate.
  12089. @item STARTPTS
  12090. The PTS of the first frame.
  12091. @item STARTT
  12092. the time in seconds of the first frame
  12093. @item INTERLACED
  12094. State whether the current frame is interlaced.
  12095. @item T
  12096. the time in seconds of the current frame
  12097. @item POS
  12098. original position in the file of the frame, or undefined if undefined
  12099. for the current frame
  12100. @item PREV_INPTS
  12101. The previous input PTS.
  12102. @item PREV_INT
  12103. previous input time in seconds
  12104. @item PREV_OUTPTS
  12105. The previous output PTS.
  12106. @item PREV_OUTT
  12107. previous output time in seconds
  12108. @item RTCTIME
  12109. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12110. instead.
  12111. @item RTCSTART
  12112. The wallclock (RTC) time at the start of the movie in microseconds.
  12113. @item TB
  12114. The timebase of the input timestamps.
  12115. @end table
  12116. @subsection Examples
  12117. @itemize
  12118. @item
  12119. Start counting PTS from zero
  12120. @example
  12121. setpts=PTS-STARTPTS
  12122. @end example
  12123. @item
  12124. Apply fast motion effect:
  12125. @example
  12126. setpts=0.5*PTS
  12127. @end example
  12128. @item
  12129. Apply slow motion effect:
  12130. @example
  12131. setpts=2.0*PTS
  12132. @end example
  12133. @item
  12134. Set fixed rate of 25 frames per second:
  12135. @example
  12136. setpts=N/(25*TB)
  12137. @end example
  12138. @item
  12139. Set fixed rate 25 fps with some jitter:
  12140. @example
  12141. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12142. @end example
  12143. @item
  12144. Apply an offset of 10 seconds to the input PTS:
  12145. @example
  12146. setpts=PTS+10/TB
  12147. @end example
  12148. @item
  12149. Generate timestamps from a "live source" and rebase onto the current timebase:
  12150. @example
  12151. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12152. @end example
  12153. @item
  12154. Generate timestamps by counting samples:
  12155. @example
  12156. asetpts=N/SR/TB
  12157. @end example
  12158. @end itemize
  12159. @section settb, asettb
  12160. Set the timebase to use for the output frames timestamps.
  12161. It is mainly useful for testing timebase configuration.
  12162. It accepts the following parameters:
  12163. @table @option
  12164. @item expr, tb
  12165. The expression which is evaluated into the output timebase.
  12166. @end table
  12167. The value for @option{tb} is an arithmetic expression representing a
  12168. rational. The expression can contain the constants "AVTB" (the default
  12169. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12170. audio only). Default value is "intb".
  12171. @subsection Examples
  12172. @itemize
  12173. @item
  12174. Set the timebase to 1/25:
  12175. @example
  12176. settb=expr=1/25
  12177. @end example
  12178. @item
  12179. Set the timebase to 1/10:
  12180. @example
  12181. settb=expr=0.1
  12182. @end example
  12183. @item
  12184. Set the timebase to 1001/1000:
  12185. @example
  12186. settb=1+0.001
  12187. @end example
  12188. @item
  12189. Set the timebase to 2*intb:
  12190. @example
  12191. settb=2*intb
  12192. @end example
  12193. @item
  12194. Set the default timebase value:
  12195. @example
  12196. settb=AVTB
  12197. @end example
  12198. @end itemize
  12199. @section showcqt
  12200. Convert input audio to a video output representing frequency spectrum
  12201. logarithmically using Brown-Puckette constant Q transform algorithm with
  12202. direct frequency domain coefficient calculation (but the transform itself
  12203. is not really constant Q, instead the Q factor is actually variable/clamped),
  12204. with musical tone scale, from E0 to D#10.
  12205. The filter accepts the following options:
  12206. @table @option
  12207. @item size, s
  12208. Specify the video size for the output. It must be even. For the syntax of this option,
  12209. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12210. Default value is @code{1920x1080}.
  12211. @item fps, rate, r
  12212. Set the output frame rate. Default value is @code{25}.
  12213. @item bar_h
  12214. Set the bargraph height. It must be even. Default value is @code{-1} which
  12215. computes the bargraph height automatically.
  12216. @item axis_h
  12217. Set the axis height. It must be even. Default value is @code{-1} which computes
  12218. the axis height automatically.
  12219. @item sono_h
  12220. Set the sonogram height. It must be even. Default value is @code{-1} which
  12221. computes the sonogram height automatically.
  12222. @item fullhd
  12223. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12224. instead. Default value is @code{1}.
  12225. @item sono_v, volume
  12226. Specify the sonogram volume expression. It can contain variables:
  12227. @table @option
  12228. @item bar_v
  12229. the @var{bar_v} evaluated expression
  12230. @item frequency, freq, f
  12231. the frequency where it is evaluated
  12232. @item timeclamp, tc
  12233. the value of @var{timeclamp} option
  12234. @end table
  12235. and functions:
  12236. @table @option
  12237. @item a_weighting(f)
  12238. A-weighting of equal loudness
  12239. @item b_weighting(f)
  12240. B-weighting of equal loudness
  12241. @item c_weighting(f)
  12242. C-weighting of equal loudness.
  12243. @end table
  12244. Default value is @code{16}.
  12245. @item bar_v, volume2
  12246. Specify the bargraph volume expression. It can contain variables:
  12247. @table @option
  12248. @item sono_v
  12249. the @var{sono_v} evaluated expression
  12250. @item frequency, freq, f
  12251. the frequency where it is evaluated
  12252. @item timeclamp, tc
  12253. the value of @var{timeclamp} option
  12254. @end table
  12255. and functions:
  12256. @table @option
  12257. @item a_weighting(f)
  12258. A-weighting of equal loudness
  12259. @item b_weighting(f)
  12260. B-weighting of equal loudness
  12261. @item c_weighting(f)
  12262. C-weighting of equal loudness.
  12263. @end table
  12264. Default value is @code{sono_v}.
  12265. @item sono_g, gamma
  12266. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12267. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12268. Acceptable range is @code{[1, 7]}.
  12269. @item bar_g, gamma2
  12270. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12271. @code{[1, 7]}.
  12272. @item timeclamp, tc
  12273. Specify the transform timeclamp. At low frequency, there is trade-off between
  12274. accuracy in time domain and frequency domain. If timeclamp is lower,
  12275. event in time domain is represented more accurately (such as fast bass drum),
  12276. otherwise event in frequency domain is represented more accurately
  12277. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12278. @item basefreq
  12279. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12280. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12281. @item endfreq
  12282. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12283. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12284. @item coeffclamp
  12285. This option is deprecated and ignored.
  12286. @item tlength
  12287. Specify the transform length in time domain. Use this option to control accuracy
  12288. trade-off between time domain and frequency domain at every frequency sample.
  12289. It can contain variables:
  12290. @table @option
  12291. @item frequency, freq, f
  12292. the frequency where it is evaluated
  12293. @item timeclamp, tc
  12294. the value of @var{timeclamp} option.
  12295. @end table
  12296. Default value is @code{384*tc/(384+tc*f)}.
  12297. @item count
  12298. Specify the transform count for every video frame. Default value is @code{6}.
  12299. Acceptable range is @code{[1, 30]}.
  12300. @item fcount
  12301. Specify the transform count for every single pixel. Default value is @code{0},
  12302. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12303. @item fontfile
  12304. Specify font file for use with freetype to draw the axis. If not specified,
  12305. use embedded font. Note that drawing with font file or embedded font is not
  12306. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12307. option instead.
  12308. @item fontcolor
  12309. Specify font color expression. This is arithmetic expression that should return
  12310. integer value 0xRRGGBB. It can contain variables:
  12311. @table @option
  12312. @item frequency, freq, f
  12313. the frequency where it is evaluated
  12314. @item timeclamp, tc
  12315. the value of @var{timeclamp} option
  12316. @end table
  12317. and functions:
  12318. @table @option
  12319. @item midi(f)
  12320. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12321. @item r(x), g(x), b(x)
  12322. red, green, and blue value of intensity x.
  12323. @end table
  12324. Default value is @code{st(0, (midi(f)-59.5)/12);
  12325. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12326. r(1-ld(1)) + b(ld(1))}.
  12327. @item axisfile
  12328. Specify image file to draw the axis. This option override @var{fontfile} and
  12329. @var{fontcolor} option.
  12330. @item axis, text
  12331. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12332. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12333. Default value is @code{1}.
  12334. @end table
  12335. @subsection Examples
  12336. @itemize
  12337. @item
  12338. Playing audio while showing the spectrum:
  12339. @example
  12340. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12341. @end example
  12342. @item
  12343. Same as above, but with frame rate 30 fps:
  12344. @example
  12345. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12346. @end example
  12347. @item
  12348. Playing at 1280x720:
  12349. @example
  12350. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12351. @end example
  12352. @item
  12353. Disable sonogram display:
  12354. @example
  12355. sono_h=0
  12356. @end example
  12357. @item
  12358. A1 and its harmonics: A1, A2, (near)E3, A3:
  12359. @example
  12360. 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),
  12361. asplit[a][out1]; [a] showcqt [out0]'
  12362. @end example
  12363. @item
  12364. Same as above, but with more accuracy in frequency domain:
  12365. @example
  12366. 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),
  12367. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12368. @end example
  12369. @item
  12370. Custom volume:
  12371. @example
  12372. bar_v=10:sono_v=bar_v*a_weighting(f)
  12373. @end example
  12374. @item
  12375. Custom gamma, now spectrum is linear to the amplitude.
  12376. @example
  12377. bar_g=2:sono_g=2
  12378. @end example
  12379. @item
  12380. Custom tlength equation:
  12381. @example
  12382. 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)))'
  12383. @end example
  12384. @item
  12385. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12386. @example
  12387. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12388. @end example
  12389. @item
  12390. Custom frequency range with custom axis using image file:
  12391. @example
  12392. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12393. @end example
  12394. @end itemize
  12395. @section showfreqs
  12396. Convert input audio to video output representing the audio power spectrum.
  12397. Audio amplitude is on Y-axis while frequency is on X-axis.
  12398. The filter accepts the following options:
  12399. @table @option
  12400. @item size, s
  12401. Specify size of video. For the syntax of this option, check the
  12402. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12403. Default is @code{1024x512}.
  12404. @item mode
  12405. Set display mode.
  12406. This set how each frequency bin will be represented.
  12407. It accepts the following values:
  12408. @table @samp
  12409. @item line
  12410. @item bar
  12411. @item dot
  12412. @end table
  12413. Default is @code{bar}.
  12414. @item ascale
  12415. Set amplitude scale.
  12416. It accepts the following values:
  12417. @table @samp
  12418. @item lin
  12419. Linear scale.
  12420. @item sqrt
  12421. Square root scale.
  12422. @item cbrt
  12423. Cubic root scale.
  12424. @item log
  12425. Logarithmic scale.
  12426. @end table
  12427. Default is @code{log}.
  12428. @item fscale
  12429. Set frequency scale.
  12430. It accepts the following values:
  12431. @table @samp
  12432. @item lin
  12433. Linear scale.
  12434. @item log
  12435. Logarithmic scale.
  12436. @item rlog
  12437. Reverse logarithmic scale.
  12438. @end table
  12439. Default is @code{lin}.
  12440. @item win_size
  12441. Set window size.
  12442. It accepts the following values:
  12443. @table @samp
  12444. @item w16
  12445. @item w32
  12446. @item w64
  12447. @item w128
  12448. @item w256
  12449. @item w512
  12450. @item w1024
  12451. @item w2048
  12452. @item w4096
  12453. @item w8192
  12454. @item w16384
  12455. @item w32768
  12456. @item w65536
  12457. @end table
  12458. Default is @code{w2048}
  12459. @item win_func
  12460. Set windowing function.
  12461. It accepts the following values:
  12462. @table @samp
  12463. @item rect
  12464. @item bartlett
  12465. @item hanning
  12466. @item hamming
  12467. @item blackman
  12468. @item welch
  12469. @item flattop
  12470. @item bharris
  12471. @item bnuttall
  12472. @item bhann
  12473. @item sine
  12474. @item nuttall
  12475. @item lanczos
  12476. @item gauss
  12477. @item tukey
  12478. @end table
  12479. Default is @code{hanning}.
  12480. @item overlap
  12481. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12482. which means optimal overlap for selected window function will be picked.
  12483. @item averaging
  12484. Set time averaging. Setting this to 0 will display current maximal peaks.
  12485. Default is @code{1}, which means time averaging is disabled.
  12486. @item colors
  12487. Specify list of colors separated by space or by '|' which will be used to
  12488. draw channel frequencies. Unrecognized or missing colors will be replaced
  12489. by white color.
  12490. @item cmode
  12491. Set channel display mode.
  12492. It accepts the following values:
  12493. @table @samp
  12494. @item combined
  12495. @item separate
  12496. @end table
  12497. Default is @code{combined}.
  12498. @end table
  12499. @anchor{showspectrum}
  12500. @section showspectrum
  12501. Convert input audio to a video output, representing the audio frequency
  12502. spectrum.
  12503. The filter accepts the following options:
  12504. @table @option
  12505. @item size, s
  12506. Specify the video size for the output. For the syntax of this option, check the
  12507. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12508. Default value is @code{640x512}.
  12509. @item slide
  12510. Specify how the spectrum should slide along the window.
  12511. It accepts the following values:
  12512. @table @samp
  12513. @item replace
  12514. the samples start again on the left when they reach the right
  12515. @item scroll
  12516. the samples scroll from right to left
  12517. @item rscroll
  12518. the samples scroll from left to right
  12519. @item fullframe
  12520. frames are only produced when the samples reach the right
  12521. @end table
  12522. Default value is @code{replace}.
  12523. @item mode
  12524. Specify display mode.
  12525. It accepts the following values:
  12526. @table @samp
  12527. @item combined
  12528. all channels are displayed in the same row
  12529. @item separate
  12530. all channels are displayed in separate rows
  12531. @end table
  12532. Default value is @samp{combined}.
  12533. @item color
  12534. Specify display color mode.
  12535. It accepts the following values:
  12536. @table @samp
  12537. @item channel
  12538. each channel is displayed in a separate color
  12539. @item intensity
  12540. each channel is displayed using the same color scheme
  12541. @item rainbow
  12542. each channel is displayed using the rainbow color scheme
  12543. @item moreland
  12544. each channel is displayed using the moreland color scheme
  12545. @item nebulae
  12546. each channel is displayed using the nebulae color scheme
  12547. @item fire
  12548. each channel is displayed using the fire color scheme
  12549. @item fiery
  12550. each channel is displayed using the fiery color scheme
  12551. @item fruit
  12552. each channel is displayed using the fruit color scheme
  12553. @item cool
  12554. each channel is displayed using the cool color scheme
  12555. @end table
  12556. Default value is @samp{channel}.
  12557. @item scale
  12558. Specify scale used for calculating intensity color values.
  12559. It accepts the following values:
  12560. @table @samp
  12561. @item lin
  12562. linear
  12563. @item sqrt
  12564. square root, default
  12565. @item cbrt
  12566. cubic root
  12567. @item 4thrt
  12568. 4th root
  12569. @item 5thrt
  12570. 5th root
  12571. @item log
  12572. logarithmic
  12573. @end table
  12574. Default value is @samp{sqrt}.
  12575. @item saturation
  12576. Set saturation modifier for displayed colors. Negative values provide
  12577. alternative color scheme. @code{0} is no saturation at all.
  12578. Saturation must be in [-10.0, 10.0] range.
  12579. Default value is @code{1}.
  12580. @item win_func
  12581. Set window function.
  12582. It accepts the following values:
  12583. @table @samp
  12584. @item rect
  12585. @item bartlett
  12586. @item hann
  12587. @item hanning
  12588. @item hamming
  12589. @item blackman
  12590. @item welch
  12591. @item flattop
  12592. @item bharris
  12593. @item bnuttall
  12594. @item bhann
  12595. @item sine
  12596. @item nuttall
  12597. @item lanczos
  12598. @item gauss
  12599. @item tukey
  12600. @end table
  12601. Default value is @code{hann}.
  12602. @item orientation
  12603. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12604. @code{horizontal}. Default is @code{vertical}.
  12605. @item overlap
  12606. Set ratio of overlap window. Default value is @code{0}.
  12607. When value is @code{1} overlap is set to recommended size for specific
  12608. window function currently used.
  12609. @item gain
  12610. Set scale gain for calculating intensity color values.
  12611. Default value is @code{1}.
  12612. @item data
  12613. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12614. @end table
  12615. The usage is very similar to the showwaves filter; see the examples in that
  12616. section.
  12617. @subsection Examples
  12618. @itemize
  12619. @item
  12620. Large window with logarithmic color scaling:
  12621. @example
  12622. showspectrum=s=1280x480:scale=log
  12623. @end example
  12624. @item
  12625. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12626. @example
  12627. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12628. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12629. @end example
  12630. @end itemize
  12631. @section showspectrumpic
  12632. Convert input audio to a single video frame, representing the audio frequency
  12633. spectrum.
  12634. The filter accepts the following options:
  12635. @table @option
  12636. @item size, s
  12637. Specify the video size for the output. For the syntax of this option, check the
  12638. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12639. Default value is @code{4096x2048}.
  12640. @item mode
  12641. Specify display mode.
  12642. It accepts the following values:
  12643. @table @samp
  12644. @item combined
  12645. all channels are displayed in the same row
  12646. @item separate
  12647. all channels are displayed in separate rows
  12648. @end table
  12649. Default value is @samp{combined}.
  12650. @item color
  12651. Specify display color mode.
  12652. It accepts the following values:
  12653. @table @samp
  12654. @item channel
  12655. each channel is displayed in a separate color
  12656. @item intensity
  12657. each channel is displayed using the same color scheme
  12658. @item rainbow
  12659. each channel is displayed using the rainbow color scheme
  12660. @item moreland
  12661. each channel is displayed using the moreland color scheme
  12662. @item nebulae
  12663. each channel is displayed using the nebulae color scheme
  12664. @item fire
  12665. each channel is displayed using the fire color scheme
  12666. @item fiery
  12667. each channel is displayed using the fiery color scheme
  12668. @item fruit
  12669. each channel is displayed using the fruit color scheme
  12670. @item cool
  12671. each channel is displayed using the cool color scheme
  12672. @end table
  12673. Default value is @samp{intensity}.
  12674. @item scale
  12675. Specify scale used for calculating intensity color values.
  12676. It accepts the following values:
  12677. @table @samp
  12678. @item lin
  12679. linear
  12680. @item sqrt
  12681. square root, default
  12682. @item cbrt
  12683. cubic root
  12684. @item 4thrt
  12685. 4th root
  12686. @item 5thrt
  12687. 5th root
  12688. @item log
  12689. logarithmic
  12690. @end table
  12691. Default value is @samp{log}.
  12692. @item saturation
  12693. Set saturation modifier for displayed colors. Negative values provide
  12694. alternative color scheme. @code{0} is no saturation at all.
  12695. Saturation must be in [-10.0, 10.0] range.
  12696. Default value is @code{1}.
  12697. @item win_func
  12698. Set window function.
  12699. It accepts the following values:
  12700. @table @samp
  12701. @item rect
  12702. @item bartlett
  12703. @item hann
  12704. @item hanning
  12705. @item hamming
  12706. @item blackman
  12707. @item welch
  12708. @item flattop
  12709. @item bharris
  12710. @item bnuttall
  12711. @item bhann
  12712. @item sine
  12713. @item nuttall
  12714. @item lanczos
  12715. @item gauss
  12716. @item tukey
  12717. @end table
  12718. Default value is @code{hann}.
  12719. @item orientation
  12720. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12721. @code{horizontal}. Default is @code{vertical}.
  12722. @item gain
  12723. Set scale gain for calculating intensity color values.
  12724. Default value is @code{1}.
  12725. @item legend
  12726. Draw time and frequency axes and legends. Default is enabled.
  12727. @end table
  12728. @subsection Examples
  12729. @itemize
  12730. @item
  12731. Extract an audio spectrogram of a whole audio track
  12732. in a 1024x1024 picture using @command{ffmpeg}:
  12733. @example
  12734. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12735. @end example
  12736. @end itemize
  12737. @section showvolume
  12738. Convert input audio volume to a video output.
  12739. The filter accepts the following options:
  12740. @table @option
  12741. @item rate, r
  12742. Set video rate.
  12743. @item b
  12744. Set border width, allowed range is [0, 5]. Default is 1.
  12745. @item w
  12746. Set channel width, allowed range is [80, 8192]. Default is 400.
  12747. @item h
  12748. Set channel height, allowed range is [1, 900]. Default is 20.
  12749. @item f
  12750. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12751. @item c
  12752. Set volume color expression.
  12753. The expression can use the following variables:
  12754. @table @option
  12755. @item VOLUME
  12756. Current max volume of channel in dB.
  12757. @item CHANNEL
  12758. Current channel number, starting from 0.
  12759. @end table
  12760. @item t
  12761. If set, displays channel names. Default is enabled.
  12762. @item v
  12763. If set, displays volume values. Default is enabled.
  12764. @item o
  12765. Set orientation, can be @code{horizontal} or @code{vertical},
  12766. default is @code{horizontal}.
  12767. @item s
  12768. Set step size, allowed range s [0, 5]. Default is 0, which means
  12769. step is disabled.
  12770. @end table
  12771. @section showwaves
  12772. Convert input audio to a video output, representing the samples waves.
  12773. The filter accepts the following options:
  12774. @table @option
  12775. @item size, s
  12776. Specify the video size for the output. For the syntax of this option, check the
  12777. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12778. Default value is @code{600x240}.
  12779. @item mode
  12780. Set display mode.
  12781. Available values are:
  12782. @table @samp
  12783. @item point
  12784. Draw a point for each sample.
  12785. @item line
  12786. Draw a vertical line for each sample.
  12787. @item p2p
  12788. Draw a point for each sample and a line between them.
  12789. @item cline
  12790. Draw a centered vertical line for each sample.
  12791. @end table
  12792. Default value is @code{point}.
  12793. @item n
  12794. Set the number of samples which are printed on the same column. A
  12795. larger value will decrease the frame rate. Must be a positive
  12796. integer. This option can be set only if the value for @var{rate}
  12797. is not explicitly specified.
  12798. @item rate, r
  12799. Set the (approximate) output frame rate. This is done by setting the
  12800. option @var{n}. Default value is "25".
  12801. @item split_channels
  12802. Set if channels should be drawn separately or overlap. Default value is 0.
  12803. @item colors
  12804. Set colors separated by '|' which are going to be used for drawing of each channel.
  12805. @item scale
  12806. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12807. Default is linear.
  12808. @end table
  12809. @subsection Examples
  12810. @itemize
  12811. @item
  12812. Output the input file audio and the corresponding video representation
  12813. at the same time:
  12814. @example
  12815. amovie=a.mp3,asplit[out0],showwaves[out1]
  12816. @end example
  12817. @item
  12818. Create a synthetic signal and show it with showwaves, forcing a
  12819. frame rate of 30 frames per second:
  12820. @example
  12821. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  12822. @end example
  12823. @end itemize
  12824. @section showwavespic
  12825. Convert input audio to a single video frame, representing the samples waves.
  12826. The filter accepts the following options:
  12827. @table @option
  12828. @item size, s
  12829. Specify the video size for the output. For the syntax of this option, check the
  12830. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12831. Default value is @code{600x240}.
  12832. @item split_channels
  12833. Set if channels should be drawn separately or overlap. Default value is 0.
  12834. @item colors
  12835. Set colors separated by '|' which are going to be used for drawing of each channel.
  12836. @item scale
  12837. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12838. Default is linear.
  12839. @end table
  12840. @subsection Examples
  12841. @itemize
  12842. @item
  12843. Extract a channel split representation of the wave form of a whole audio track
  12844. in a 1024x800 picture using @command{ffmpeg}:
  12845. @example
  12846. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  12847. @end example
  12848. @end itemize
  12849. @section spectrumsynth
  12850. Sythesize audio from 2 input video spectrums, first input stream represents
  12851. magnitude across time and second represents phase across time.
  12852. The filter will transform from frequency domain as displayed in videos back
  12853. to time domain as presented in audio output.
  12854. This filter is primarly created for reversing processed @ref{showspectrum}
  12855. filter outputs, but can synthesize sound from other spectrograms too.
  12856. But in such case results are going to be poor if the phase data is not
  12857. available, because in such cases phase data need to be recreated, usually
  12858. its just recreated from random noise.
  12859. For best results use gray only output (@code{channel} color mode in
  12860. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  12861. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  12862. @code{data} option. Inputs videos should generally use @code{fullframe}
  12863. slide mode as that saves resources needed for decoding video.
  12864. The filter accepts the following options:
  12865. @table @option
  12866. @item sample_rate
  12867. Specify sample rate of output audio, the sample rate of audio from which
  12868. spectrum was generated may differ.
  12869. @item channels
  12870. Set number of channels represented in input video spectrums.
  12871. @item scale
  12872. Set scale which was used when generating magnitude input spectrum.
  12873. Can be @code{lin} or @code{log}. Default is @code{log}.
  12874. @item slide
  12875. Set slide which was used when generating inputs spectrums.
  12876. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  12877. Default is @code{fullframe}.
  12878. @item win_func
  12879. Set window function used for resynthesis.
  12880. @item overlap
  12881. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12882. which means optimal overlap for selected window function will be picked.
  12883. @item orientation
  12884. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  12885. Default is @code{vertical}.
  12886. @end table
  12887. @subsection Examples
  12888. @itemize
  12889. @item
  12890. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  12891. then resynthesize videos back to audio with spectrumsynth:
  12892. @example
  12893. 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
  12894. 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
  12895. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  12896. @end example
  12897. @end itemize
  12898. @section split, asplit
  12899. Split input into several identical outputs.
  12900. @code{asplit} works with audio input, @code{split} with video.
  12901. The filter accepts a single parameter which specifies the number of outputs. If
  12902. unspecified, it defaults to 2.
  12903. @subsection Examples
  12904. @itemize
  12905. @item
  12906. Create two separate outputs from the same input:
  12907. @example
  12908. [in] split [out0][out1]
  12909. @end example
  12910. @item
  12911. To create 3 or more outputs, you need to specify the number of
  12912. outputs, like in:
  12913. @example
  12914. [in] asplit=3 [out0][out1][out2]
  12915. @end example
  12916. @item
  12917. Create two separate outputs from the same input, one cropped and
  12918. one padded:
  12919. @example
  12920. [in] split [splitout1][splitout2];
  12921. [splitout1] crop=100:100:0:0 [cropout];
  12922. [splitout2] pad=200:200:100:100 [padout];
  12923. @end example
  12924. @item
  12925. Create 5 copies of the input audio with @command{ffmpeg}:
  12926. @example
  12927. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  12928. @end example
  12929. @end itemize
  12930. @section zmq, azmq
  12931. Receive commands sent through a libzmq client, and forward them to
  12932. filters in the filtergraph.
  12933. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  12934. must be inserted between two video filters, @code{azmq} between two
  12935. audio filters.
  12936. To enable these filters you need to install the libzmq library and
  12937. headers and configure FFmpeg with @code{--enable-libzmq}.
  12938. For more information about libzmq see:
  12939. @url{http://www.zeromq.org/}
  12940. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  12941. receives messages sent through a network interface defined by the
  12942. @option{bind_address} option.
  12943. The received message must be in the form:
  12944. @example
  12945. @var{TARGET} @var{COMMAND} [@var{ARG}]
  12946. @end example
  12947. @var{TARGET} specifies the target of the command, usually the name of
  12948. the filter class or a specific filter instance name.
  12949. @var{COMMAND} specifies the name of the command for the target filter.
  12950. @var{ARG} is optional and specifies the optional argument list for the
  12951. given @var{COMMAND}.
  12952. Upon reception, the message is processed and the corresponding command
  12953. is injected into the filtergraph. Depending on the result, the filter
  12954. will send a reply to the client, adopting the format:
  12955. @example
  12956. @var{ERROR_CODE} @var{ERROR_REASON}
  12957. @var{MESSAGE}
  12958. @end example
  12959. @var{MESSAGE} is optional.
  12960. @subsection Examples
  12961. Look at @file{tools/zmqsend} for an example of a zmq client which can
  12962. be used to send commands processed by these filters.
  12963. Consider the following filtergraph generated by @command{ffplay}
  12964. @example
  12965. ffplay -dumpgraph 1 -f lavfi "
  12966. color=s=100x100:c=red [l];
  12967. color=s=100x100:c=blue [r];
  12968. nullsrc=s=200x100, zmq [bg];
  12969. [bg][l] overlay [bg+l];
  12970. [bg+l][r] overlay=x=100 "
  12971. @end example
  12972. To change the color of the left side of the video, the following
  12973. command can be used:
  12974. @example
  12975. echo Parsed_color_0 c yellow | tools/zmqsend
  12976. @end example
  12977. To change the right side:
  12978. @example
  12979. echo Parsed_color_1 c pink | tools/zmqsend
  12980. @end example
  12981. @c man end MULTIMEDIA FILTERS
  12982. @chapter Multimedia Sources
  12983. @c man begin MULTIMEDIA SOURCES
  12984. Below is a description of the currently available multimedia sources.
  12985. @section amovie
  12986. This is the same as @ref{movie} source, except it selects an audio
  12987. stream by default.
  12988. @anchor{movie}
  12989. @section movie
  12990. Read audio and/or video stream(s) from a movie container.
  12991. It accepts the following parameters:
  12992. @table @option
  12993. @item filename
  12994. The name of the resource to read (not necessarily a file; it can also be a
  12995. device or a stream accessed through some protocol).
  12996. @item format_name, f
  12997. Specifies the format assumed for the movie to read, and can be either
  12998. the name of a container or an input device. If not specified, the
  12999. format is guessed from @var{movie_name} or by probing.
  13000. @item seek_point, sp
  13001. Specifies the seek point in seconds. The frames will be output
  13002. starting from this seek point. The parameter is evaluated with
  13003. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13004. postfix. The default value is "0".
  13005. @item streams, s
  13006. Specifies the streams to read. Several streams can be specified,
  13007. separated by "+". The source will then have as many outputs, in the
  13008. same order. The syntax is explained in the ``Stream specifiers''
  13009. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13010. respectively the default (best suited) video and audio stream. Default
  13011. is "dv", or "da" if the filter is called as "amovie".
  13012. @item stream_index, si
  13013. Specifies the index of the video stream to read. If the value is -1,
  13014. the most suitable video stream will be automatically selected. The default
  13015. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13016. audio instead of video.
  13017. @item loop
  13018. Specifies how many times to read the stream in sequence.
  13019. If the value is less than 1, the stream will be read again and again.
  13020. Default value is "1".
  13021. Note that when the movie is looped the source timestamps are not
  13022. changed, so it will generate non monotonically increasing timestamps.
  13023. @item discontinuity
  13024. Specifies the time difference between frames above which the point is
  13025. considered a timestamp discontinuity which is removed by adjusting the later
  13026. timestamps.
  13027. @end table
  13028. It allows overlaying a second video on top of the main input of
  13029. a filtergraph, as shown in this graph:
  13030. @example
  13031. input -----------> deltapts0 --> overlay --> output
  13032. ^
  13033. |
  13034. movie --> scale--> deltapts1 -------+
  13035. @end example
  13036. @subsection Examples
  13037. @itemize
  13038. @item
  13039. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13040. on top of the input labelled "in":
  13041. @example
  13042. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13043. [in] setpts=PTS-STARTPTS [main];
  13044. [main][over] overlay=16:16 [out]
  13045. @end example
  13046. @item
  13047. Read from a video4linux2 device, and overlay it on top of the input
  13048. labelled "in":
  13049. @example
  13050. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13051. [in] setpts=PTS-STARTPTS [main];
  13052. [main][over] overlay=16:16 [out]
  13053. @end example
  13054. @item
  13055. Read the first video stream and the audio stream with id 0x81 from
  13056. dvd.vob; the video is connected to the pad named "video" and the audio is
  13057. connected to the pad named "audio":
  13058. @example
  13059. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13060. @end example
  13061. @end itemize
  13062. @subsection Commands
  13063. Both movie and amovie support the following commands:
  13064. @table @option
  13065. @item seek
  13066. Perform seek using "av_seek_frame".
  13067. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13068. @itemize
  13069. @item
  13070. @var{stream_index}: If stream_index is -1, a default
  13071. stream is selected, and @var{timestamp} is automatically converted
  13072. from AV_TIME_BASE units to the stream specific time_base.
  13073. @item
  13074. @var{timestamp}: Timestamp in AVStream.time_base units
  13075. or, if no stream is specified, in AV_TIME_BASE units.
  13076. @item
  13077. @var{flags}: Flags which select direction and seeking mode.
  13078. @end itemize
  13079. @item get_duration
  13080. Get movie duration in AV_TIME_BASE units.
  13081. @end table
  13082. @c man end MULTIMEDIA SOURCES