15 ms·
Guide to FFmpeg
- stefanvdw1 4y agoI can only recommend this tool to help you build pipelines in a visual way: https://ffmpeg.guide https://ffmpeg.guide Not affiliated, just a happy user
- elAhmo 4y agoMaybe slightly unrelated, but I really like the presentation, fonts and design of your website. Could you share more about that?
- buss_jan 4y agoFFmpeg is powerful technology, yet approaching it can be very daunting. So we decided to create an approachable guide for intermediate devs. Feedback is very much appreciated.
- chewz 4y agoThank you...
- vesinisa 4y agoThink you might have a editorial content left under the headline "Installing FFmpeg Check". There are instructions for installing FFmpeg (first I thought it was maybe some tool called "FFmpeg Check" to "check" the output of an FFmpeg command line, like in the above screenshot, but this turned out not to be the case :)
- buss_jan 4y agoThanks, removed the check, it was indeed just awkwardly worded.
- dontbenebby 4y agoAgreed - I’ve been looking for a one liner to turn a series of stills into a gif for a while and buried in my todos is a note to read the documentation so thanks, I’ll read this when I’m done w/ a few other todos this morning. Someone should do a gui for common tasks it can do line there used to be the Zenmap gui for nmap. (Learning how to do those sorts of simple guis quickly in python of something is another holiday todo, if anyone has suggestions on that - all my tools thus far are gui based and I need to make sure as many folks as possible use them.)
- vanderZwan 4y agoA few years ago I went through exactly that kind of holiday todo list and created a few bash scripts for video-to-gif, gif-to-video, and image stabilization. Here's the script I cobbled together from various internet searches for the video-to-gif one, it works well enough for that purpose and all you have to do is remove the video-to-PNG bits at the start.: https://gist.github.com/JobLeonard/5f99b712ba77b7aa82696c1368fd265f https://gist.github.com/JobLeonard/5f99b712ba77b7aa82696c136...
- dontbenebby 4y agoThanks for the code! I'm going to pull down a copy and take a look and then later tweak it... The goal is gonna be to have something where I can give it units of time as arguments and do clips. So for example, you could give it a dot mkv and say from 30 seconds in to 300 seconds in, take that into stills then create a GIF... or an aPNG but... I'll take a look, play around, I need to learn to read undocumented code better this will be a good exercise since it's not some possibly zero day malware that didn't get past noscript like the last time I did that... (But to swing it back to graphics: there a reason people don't use apng more? The reason I got ages ago is PNG is more for line drawings, not raster images like what you'd normally use a JPEG format for, but it's my understanding you can play with settings and get a similar level of compression without the patent encumberment of things like GIF with aPNG, and that it's supported by pretty much every browser except for... [checks wikipedia] Internet Explorer[1]?) Anyways TL;DR: sorry to wall of text you, I'm pounding caffeine and reading the news and jumping between several projects at once -- thanks for the code, I'm going to take a look later -- right now gotta switch locations in ~10 minutes like I'm a Tor circuit ;-) https://en.wikipedia.org/wiki/APNG#Support https://en.wikipedia.org/wiki/APNG#Support
- TruffleLabs 4y agoHandBrake is your gui to FFMpeg "HandBrake uses FFmpeg under the hood and generally can open whatever FFmpeg will, in addition to disc-based formats like DVD and Blu-ray." Via https://handbrake.fr/docs/en/1.3.0/technical/source-formats.html https://handbrake.fr/docs/en/1.3.0/technical/source-formats....
- antihero 4y agoThis is absolutely fantastic, thanks!
- bambax 4y agoExcellent guide, thanks! Shameless plug: a while ago I wrote a simple Python script to remove silent parts from video using ffmpeg, which AFAIK it doesn't do out of the box: https://github.com/bambax/Remsi https://github.com/bambax/Remsi It might be helpful to others.
- asicsp 4y agoSee also: https://github.com/WyattBlue/auto-editor https://github.com/WyattBlue/auto-editor (automatically edit video and audio by analyzing a variety of methods, most notably audio loudness)
- dceddia 4y agoLate 2020 I had the same thought, I was making screencasts and hated doing all the cutting to turn my 45 minutes of mistakes into a 3 minute video. So I made a similar script in Node, where it used ffmpeg’s silencedetect and instead of outputting a new video, it saved an EDL file that I could import into an editor like DaVinci Resolve, and then I could fine tune the edits. As soon as that worked I wanted more - mostly just really wanted the process to be interactive and real-time, instead of the run-check-tweak-repeat cycle of using a script. So I ended up down the rabbit hole of building a video editor instead of making screencasts, and now Recut exists (https://getrecut.com https://getrecut.com). It’s basically an interactive silence remover. I still haven’t finished those screencasts but now I have an editor haha. While it’s pretty basic, it’s saving folks a bunch of time, and there’s lots more cool stuff I want to add between automations and basic manual editing features.
- vagrantJin 4y agoWell done sir! Your're a hacker role model.
- tnorthcutt 4y ago1. Recut looks awesome, and 2. "I still haven’t finished those screencasts but now I have an editor" amazing :D
- jojohack 4y ago
- jpmattia 4y agoIt's a nice guide, and it will be very useful to a large number of folks. > Feedback is very much appreciated. Nothing about captions that I could find quickly, which seems like an oversight.
- buss_jan 4y agoIt is indeed, thanks for pointing it out. We'll add something about adding text.
- coldpie 4y agoThank you. Please get rid of the cookie popup. If a lawyer tells you you need it, find a better lawyer.
- ryandrake 4y agoI agree with this one. On mobile it's a full-screen capture, too. Totally overboard. Why would a reference guide even need cookies? If the author is worried about lawyers, I'd just ditch the cookie use altogether.
- waltbosz 4y agoHow long before browsers have a built in setting to automatically tell these cookie prompts "essential cookies only please"?
- pessimizer 4y agoNever. If there's anything that browser developers hate, it's for their users to have fine control over what the sites they visit either save (or run) on their computers. proof: they've had plenty of time, and even browsers that claim to be public services can't even keep the APIs stable for cookie/storage control.
- Eisenstein 4y agoopposing proof: Brave does.
- pessimizer 4y agoGodspeed to Brave.
- GeorgeWBasic 4y agoI sure would love it if they came up with a way to block those "intent to leave" popups too.
- 1vuio0pswjnm7 4y ago
- throw7 4y agoAn example on how to seek and cut video exactly on it's "I-frames" would be nice. The few times I've searched, I've never really found what I'm looking for. Usually I just use avidemux to seek and cut to keyframes.
- Melatonic 4y agoI frames are full frames as far as I know - they are considered keyframes because you CAN physically jump to them. In between frames are going through temporal compression (all frames are going through image compression individually as well) which means they rely on the previous and next frame for information.
- astrange 4y agoYou shouldn't need to care about that; video formats should support clipping to non-keyframes by including the preceding GOP at negative playback times, so it skips to the frame you started the clip at. (MOV in fact does support this, but ffmpeg doesn't play it back properly.)
- gyan 4y ago> ffmpeg doesn't play it back properly Can't repro here. Commands: ffmpeg -ss X -i INPUT -c copy -t 10 test.mp4 ffplay test.mp4 where X is not a KF time. Plays from X with audio in sync for 10 secs.
- astrange 4y agoWell, I haven't tried it recently, but it's probably rounding your start time to the nearest keyframe.
- deleted 4y ago[deleted]
- rogerz46 4y agoThank you so much for sharing this and really help my daily tasks. I can automate them in CLI instead of GUI now.
- vovi-z 4y agoI'm learning ffmpeg to do some audio/visual manipulation for a backend service and was looking for the basics. This is perfect. As far as feedback goes, I noticed when running through the guide that the following command is missing an -i flag: ffplay -vf "drawtext=text='HELLO THERE':y=h-text_h-10:x=(w/2-text_w/2):fontsize=200:f I've already learned a lot from the ffmpeg concepts section. Appreciate it.
- Yeahsureok 4y agoCould I recommend a table of contents? It looks great, bookmarked.
- defrost 4y agoA ToC is there as an On This Page block just under the first image near the top .. the section title lines following are links to deeper in the page document.
- ranting-moth 4y agoI did not notice that until you said it.
- TehShrike 4y agoBut all of the useful bits that I would want to navigate to directly a month from now are subheadings under those top-level headings. The TOC should contain all relevant subheadings, not just the top-level headings
- ranting-moth 4y agoNot to criticize the guide, it's brilliant! If asked for improvements, I'd suggest adding a table of contents. Slightly off topic, but the guide does suggests reading time. It's interesting that people keep using read estimates for technical/scientific/professional documentation. This one says it's a 58 minute read. Not 1 hour, not 59 minutes, but spot on 58 minutes. Now, I'm not a novice in using ffmpeg and I think I'm at least an average person. I can tell you that it would take me a _lot_ longer to read this guide in a meaningful manner. But, a brilliant guide. I'm definitely going to use it to expand my ffmpeg knowledge.
- llampx 4y agoIts reading time, not understanding time :P
- buss_jan 4y agoThere should be a table of contents at the beginning of the post. It's not very detailed, but expands as you scroll to each section. I agree the reading time does not really convey too much useful info, the blogging platform is designed for simpler and shorter posts. Maybe a replacing it with a wordcount would be better.
- madeofpalk 4y agoEstimate reading time from words per minute. Here's an NPM package that'll do it for you! https://www.npmjs.com/package/reading-time https://www.npmjs.com/package/reading-time
- iso1631 4y agoIs that estimate really accurate to 2% that using 58 minutes rather than "about an hour" implies?
- madeofpalk 4y agoI guess it is easier, dev wise, to round a WPM-calculation than do fuzzy duration logic. I wouldn't stress too much about it
- rjzzleep 4y agoNot really related to the guide, but does anyone know how to handle audio pitch when speeding up when using FFmpeg libraries instead of the cli tool?
- DrBazza 4y agoUsing ffmpeg to stream for gaming: https://drewdevault.com/2022/10/12/In-praise-of-ffmpeg.html https://drewdevault.com/2022/10/12/In-praise-of-ffmpeg.html
- rurtrack 4y agoI'm using ffmpeg.wasm in the browser and let me tell you it is indeed something else. Like you, it used to be just a handy tool to convert stuff. But being able to process video straight inside the browser literally blew my mind
- pjc50 4y agoI think I might have a use case for that, I'd no idea that it was now available in wasm!
- sorenjan 4y agoThat's really cool! I wonder if you could stream to a Chromecast?
- blueflow 4y agoThis is a brilliant way for people to avoid reading the official ffmpeg manpages.
- moffkalast 4y agoOne day the imperium of man will be finally defeated.
- scoutt 4y agoA guide like this is always welcome. My biggest struggle with FFmpeg was to find clear documentation, tutorials and examples about API usage. All the guides out there (including this one) is for the command line version, or if the tutorial focuses on the API, it's probably outdated. Every time I have to go back and do something with FFMPEG I have to just plainly read the code of FFPlay to "catch-up" with the workflow. And don't get me started on that time I had modify the FFmpeg libs to provide support and implement an H264 encode/decoder on a custom architecture!!
- gyan 4y agoFor API use, see the examples in https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples
- onion2k 4y agoMy biggest struggle with FFmpeg was to find clear documentation... I've found the ffmpeg documentation does a good job as a technical reference. The problem is that most people reading it are actually expecting a 'what options will fix my video' how-to guide.
- mickael-kerjean 4y agoWow are you the guy from: "Interview with FFMPEG enthusiast in 2022": https://www.youtube.com/watch?v=9kaIXkImCAM https://www.youtube.com/watch?v=9kaIXkImCAM ? :)
- kcsaba 4y agoNo, but that guy is awesome!:))
- aargh_aargh 4y agoThere's a myriad of ffmpeg examples on the web so I wish there was something like https://explainshell.com/ https://explainshell.com/ specifically for ffmpeg (including parsing filters). I can imagine it could even include visualization, e.g. a two-way mapping between CLI parameter and on-screen rectangle for picture-in-picture/watermark removal coordinates, cut marks in video timeline, tree of input/output streams, tree of filters... so a CLI parser+generator.
- asicsp 4y agoClosest I can think of is https://ffmpeg.guide/ https://ffmpeg.guide/ (discussed last month: https://news.ycombinator.com/item?id=33383023 https://news.ycombinator.com/item?id=33383023)
- xenodium 4y agoWhile, I’ve been collecting useful one-liners for some time, there was always friction to apply them: search my notes, copy, paste, edit, etc. As of recently, I finally landed on a solution I feel very comfortable with: - Write templated one-liners (could be longer scripts too), automatically replacing which files to apply them to. - Wrap the one-liners with a tiny elisp function with a meaningful name. - From Emacs, I can now easily apply these wonderful one-liners to either the current file or a list of them, without having to remember details nor tweak the commands. Fuzzy searching to apply commands works great. You can see an ffmpeg example in a recent post https://xenodium.com/seamless-command-line-utils https://xenodium.com/seamless-command-line-utils
- sbt567 4y agoI'm using navi[0] for this exact purpose and very happy with it. Now it is one of indispensable tool for my workflow [0] https://github.com/denisidoro/navi https://github.com/denisidoro/navi
- cyborgx7 4y agoThis is all very interesting, but I don't want to know all of this information, and I don't want to have to know it. What I need is some kind of wrapper with sane defaults, such that when I perform some kind of operation on a video file, I only have to specify the parameters that matter to me. The last time I tried to work like that, the bitrate was unusable afterwards. I don't want to have to think about the bitrate to create a clip of a video.
- staindk 4y agoI'm late with this reply but I've found LosslessCut[1] works quite well for what I need (cutting gameplay footage to upload to youtube). It doesn't have very many features though. [1] https://github.com/mifi/lossless-cut https://github.com/mifi/lossless-cut
- deleted 4y ago[deleted]
- johnnymorgan 4y agoThere are GUIs for ffmpeg out there, I haven't used one in awhile but they exist
- ythrowawa123457 4y agoThere was a decent wrapper tool called "transcode" which I really liked. Unfortunately went unmaintained and seems to have been forgotten by the internet (webpage has went away and I can only find some traces of its existance in some wikis).
- ythrowawa123457 4y agoDigging a bit deeper it seems the fate was the main developer lacking time and not finding anyone stepping in for four years and Berlios shutting down their servers. Makes you wonder which other open source projects have just vanished. Sun May 30 11:16:00 CEST 2010 Call for developers Transcode, like any opensource project, is always in need of contributions, but the situation has reached crisis point in recent weeks. Despite a rich roadmap and plenty of ideas and proposals, the project is short of developers and close to stall. Moreover, one of the main developers (myself) has suspended its contribution to the development and maintainance for lack of time. If you are interested in partecipating, bring it on! This is the right time! Join the development mailing list: transcode-devel at exit1 dot org (don't worry, the traffic is very low) and learn how you can contribute to the project. Transcode needs you! PLEASE NOTE! Transcode does'nt need hardware or money donations! Posted by fromani | Permanent link | File under: general, devnote, transcode, announce
- asicsp 4y agoSee also: https://wiki.archlinux.org/title/FFmpeg https://wiki.archlinux.org/title/FFmpeg
- slhck 4y agoThis is a very comprehensive guide with actually reasonable examples and suggestions! I think there's really not much more to add here, because eventually you'll be deep in the rabbithole that is FFmpeg, and you'll be browsing mailing lists, visiting Stack Exchange, etc. to get help. Cross-referencing the FFmpeg wiki wherever possible would be good, as there is so much outdated information on the Internet, and at least the wiki is a somewhat up-to-date reference.
- narag 4y agoThe ultimate guide for me would include how to extract a short clip from a longer video specifying the start time in (minutes:)seconds and the duration or, alternatively, stop time. Actually I created a GUI to do exactly that, calling the ffmpeg executable. So? It doesn't work as it should. Depending in what point you start, you will find a very noticeable interval with black video. I do understand why it happens, but that's not the point.
- hnarn 4y agohandbrake-cli does this well but the syntax for begin and end timestamps is pretty confusing when combined
- deleted 4y ago[deleted]
- Wowfunhappy 4y agoAre you using -codec copy? If so, this happens because (most) frames in modern codecs are not discrete. They rely on information from previous frames to construct the image. If you cut a stream in the middle, it takes many frames before there's enough information to be displayed. (The solution would be to re-encode up until the first discrete "keyframe"... and I don't know how to do that with ffmpeg.)
- antegamisou 4y agoSee also: Cutting the videos based on start and end time using ffmpeg https://stackoverflow.com/a/18449609 https://stackoverflow.com/a/18449609
- narag 4y agoThanks, I see there's talking about the frames problem, but not sure if it's just solved in a new version or I should change some parameters, I'll give it a try next time I need to use the program.
- 4y ago
- Turbots 4y ago
- nubero 4y agoThat article is a far longer joke than the two word classic “Desktop Linux”. Seriously though: good software has a user interface.
- nubero 4y agoJust to be clear: That the article itself exists is no joke and certainly helpful to the people who use it. that being said, I work with video every day and neither I nor my filmmaking friend use it. It’s a tool for the same kind of people who like to spend sundays in their garage, fixing their cars. In that example, the people who need to get actual work done are the ones who take their cars out and drive them…
- c120 4y agoGet introduction to ffmeg, but it misses a lot of pro use cases. Mine would be to find out, if ffmpeg can create a chunked stream as an output (basically one like most TV stations use nowadays) which outputs parts and a updates m3u8 playlist with it...
- sylware 4y agoooof! That's really good work. As suggested, a link to a navigation index would be nice. Would make it a separate html page with a big fat link at the start of your guide, or use an html table as layout and no, html table as layout are _not_ harmful. Something which is worth of interest: AMD is supposed to have published AV1 hardware encoding/decoding ffmpeg code (this one is "oooof!" too... if it is cross-platform, or at least elf/linux).
- tartoran 4y agoWhat I use FFmpeg for is to chop large videos and I love it for that, it’s very fast. But Im no expert so I just created a user friendly batch file to set the in and outs and file input and output and a simple help with examples when I forget the params.
- oleg_antonyan 4y agoIs there similar guide but for developers, describing how to use libav, up-to-date example audio player, etc?
- zerop 4y agoIs it possible to have FFmpeg in browser (A JS port)?
- lightbendover 4y agohttps://github.com/ffmpegwasm/ffmpeg.wasm https://github.com/ffmpegwasm/ffmpeg.wasm
- zerop 4y agoIs there a good FFmpeg front end?
- imbnwa 4y agoff·Works if you're on macOS[0] [0]https://www.ffworks.net/ https://www.ffworks.net/
- apocalyptic0n3 4y agoHandbrake uses ffmpeg in the background (a forked version if I recall correctly).
- pessimizer 4y agoI'm slowly starting to realize that almost all video tools on linux and plenty elsewhere are ffmpeg front ends. ffmpeg is too big for one frontend.
- shantnutiwari 4y agoSorry, I didnt find the guide very useful-- too much info, it looks like its written for PhD students rather than averge users. Sometime ago I bought a book "FFMPEG Zero to Hero" by Nick Ferrano-- I recommdend that instead. The book contains more practical info tahts immeditely useful, but not always easy to find online
- _tom_ 4y agohttps://ffmpegfromzerotohero.com https://ffmpegfromzerotohero.com
- djha-skin 4y agoI'm on a project right now where I'm using FFMPeg. It turns out that for the Apple stuff it loses a lot of color information. Compressor captures this color information by using ICC profiles that it generates from (the quick time headers of?) a .mov file in non obvious ways. Gamma, contrast, and chroma are lost in transit. This is perhaps not a huge deal since we're dealing with a proprietary file format anyway, but it does mean I had to stop using FFMPeg in the project, which was a shame.
- dangerlibrary 4y agoI worked with ffmpeg for a few years about 6-7 years ago. If I learned anything from that time period, it's that whenever I started a sentence with "ffmpeg doesn't do ..." I was wrong. It may not do it out of the box, and the way to do it may not be documented anywhere, but I was always wrong.
- cogman10 4y agoThis is probably the most complicated part about ffmpeg. It does EVERYTHING. However, much like the tar command, it takes a lot of googling and doc digging to find the right magic combination of flags and settings to make EVERYTHING happen. That's not really a knock on it, ffmpeg has some pretty reasonable defaults all around. However, there's a billion codecs and use cases that make it's job challenging.
- waltbosz 4y agoI'll agree, ffmpeg is super powerful, but here is a situation where I just couldn't get it working: How do I take a sequence of 5000 pngs, apply a 5 frame crossfade between each one, and then output the resulting mp4 ? I spent days on trying to figure it out, and in the end I had to generate the xfade frames with imagemagik, then I had to split the rendering into separate mp4s and stitch them together. I just couldn't get it to slurp in a big list of files and do the filter all in one go. I can't exactly remember what went wrong when I tried to ask it to render the ~25000 frame from imagemagik. I guess this fits your definition of "not do it out of the box".
- apocalyptic0n3 4y agoI haven't read through this entire thing (yet), just skimmed it to get a feel for it. I've been incorporating ffmpeg into projects and using it for personal homelab use for over a decade now and this has to be the most complete guide I've seen on the subject. It's extremely thorough but seems to be written in a way that a beginning could pick up and use. Massive props to the author(s) here; this was no easy task and developers everywhere will benefit from it. I've shared it with my team in the hopes that it will make future projects easier.
- truth_seeker 4y agowell written blog. thanks for sharing
- INTPenis 4y agoHey I love your effort. Unfortunately ffmpeg is not a tool that can be properly demystified in one post. Other's have already suggested this but on a desktop browser this guide desperately needs a more visible ToC. Also one thing I did last year was add floating text to videos with ffmpeg's drawtext plugin, something I think people often want to do. For example adding reactions, or subs. I'd very much appreciate more guides on how to do that.
- miles 4y agoThanks so much for crafting and sharing this guide. Echoing some of the cookie comments[0], another issue with the popup is that in macOS Safari 16.1 with an adblocker extension enabled, the page looks like this: https://imgur.com/a/0SZRSTw https://imgur.com/a/0SZRSTw . As noted in the screenshot, the five various buttons to accept, reject, save, etc. do not work to dismiss the notice. [0] https://news.ycombinator.com/item?id=33774040 https://news.ycombinator.com/item?id=33774040
- andirk 4y agoPut less important things at the bottom! It's that simple. Most text-heavy content should work without Javascript. Also helps search engines understand that your site isn't selling batches of cookies :)
- sfmike 4y agois there currently a way to remove floating watermarks with ffmpeg?
- nintendo1889 4y agoFFmpeg has the longest man page in existence by far.
- frog360 4y agoI recently had to use ffmpeg, and I ended up scrapping it in favor of sounddevice in python. Thanks for the helpful info
- NaturalPhallacy 4y agoAnyone else get five whole screens (1440p) of nothing but cookie shenanigans? I thought it was the wrong link at first. Clicking reject all does nothing.
- filmgirlcw 4y agoI really appreciate this guide. I use FFmpeg on the daily and still frequently have to glance at guides and whatnot (for things I haven't scripted), to the point that I needed to find a good frontend. The best I have come across, for macOS anwyay, is ffWorks [1]. I bought it earlier this year and it has been a game-changer for me when I need to do certain types of conversions that are just cumbersome for me to look up or that I don't have scripted. So as much as I appreciate the guide, for anyone (on Mac) looking for a front-end, ffWorks is what you want. Well worth the money for heavy users. [1]: https://www.ffworks.net/ https://www.ffworks.net/
- AndrewUnmuted 4y ago
- bool3max 4y agoSlightly off-topic: Recently I needed a way to add chapter information to 200 or so local MP4 video files of varying codecs (though mostly H264). It wasn't hard to get the job done with FFmpeg, though I was very surprised that adding such simple metadata to an MP4 container, with `-codec copy`, takes a surprisingly long time (around 5 or so minutes for an ~8GB file). I don't know why that is, as I am unfamiliar with the MP4 container format's internals, though I do assume that no re-encoding/transcoding was done (again, due to -codec copy). And it most certainly wasn't a simply copy-paste of the video data into a new file either, as that would've been way quicker. Nevertheless I just let the script do its thing overnight.
- hugs 4y ago'The term "codec" is a mix of the words "coder & encoder". Those are the magic parts before and after the "decoded frames".' I thought "codec" was a portmanteau of coder & decoder. A coder and encoder are the same thing.
- effnorwood 4y ago
- jokoon 4y agoI wrote two scripts for ffmpeg, one to concatenate reddit video of different formats, with or without audio, and another to create a 2 by 2 mosaic video with xstack. It works pretty well. Only limitation is caused by python and windows, because my command line is too long (a lot of video paths, and a lot of filters).