buss_jan a year ago

FFmpeg 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.

  • bambax a year ago

    Excellent 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

    It might be helpful to others.

    • dceddia a year ago

      Late 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).

      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.

      • jojohack a year ago

        This is super-amazing and removes the main excuses why I've been reluctant to do any kind of video-casting. Thanks for sharing!

      • tnorthcutt a year ago

        1. Recut looks awesome, and 2. "I still haven’t finished those screencasts but now I have an editor" amazing :D

      • vagrantJin a year ago

        Well done sir!

        Your're a hacker role model.

    • matteocontrini a year ago

      In my experience that approach will produce out of sync audio and video for long videos. Audio frames != video frames, so the cuts must be aligned to the video frames timestamps.

    • xmichael999111 a year ago

      I get the concept, but can you possibly elaborate on the why? Is this to save time watching movies?

      • tveyben a year ago

        I hate the type of ‘instructional videos’ that have (likely programmatically) edited all and any short pause in the audio making the video appear as a 30+min continuous speak.

        I mostly interpret this as ‘see me see me - I’m good!’ in stead of ‘let me try to educate you about this subject’.

        All the natural pauses between sentences gives a much better and natural flow.

        This also includes ‘oups I made a mistake .. and fixed it like this…’

        Just like the line breaks in this comment serves a purpose;-)

        One great example of a really good tutorial is Eivind Fonn’s Spacemacs ABC videos: https://youtu.be/2y9NLIbNf_I

        Here’s my worst example of how not to teach: https://youtu.be/qtIqKaDlqXo

        This series is also bad as there is way too much zoom in and out (which distract all but the presenter!)

        https://youtu.be/qtIqKaDlqXo

        • JSavageOne a year ago

          I completely disagree. When I'm trying to learn something, I'd much rather sit through a short, efficient video than a 1 hour unedited video of someone including mistakes and rambling. Hell I generally don't even have the patience for videos in the first place and default to searching for text first unless I'm specifically looking for audio. But to each their own.

        • sbarre a year ago

          I hear you, but there's a middle ground I think.

          A bunch of non-breaking quick cuts is of course jarring and could be better, but what you describe with "mistakes and all" is too far down the other end in my mind. I would not want to sit through someone having to backpedal like that.

          But to each their own, we all learn differently.

      • bambax a year ago

        Well, no, although a digest-maker for feature films would be an interesting concept!

        It's for videos you make yourself, to remove silent parts automatically. In interviews for example, it's useful to simply remove silences.

  • dontbenebby a year ago

    Agreed - 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 a year ago

      A 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/5f99b712ba77b7aa82696c136...

      • dontbenebby a year ago

        Thanks 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

  • jpmattia a year ago

    It'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 a year ago

      It is indeed, thanks for pointing it out. We'll add something about adding text.

  • coldpie a year ago

    Thank you. Please get rid of the cookie popup. If a lawyer tells you you need it, find a better lawyer.

    • 1vuio0pswjnm7 a year ago

      Is it a popup. For example, as a text-only browser user, i.e., no Javascript engine, I generally never see cookie consent popups. (I also control whether cookies are sent via a localhost-bound forward proxy.) However I am starting to notice cookie consents placed in the HTML of the page. This is one example. The cookie consent is wrapped in <div> tags.

      To get rid of the cookie consent in this case,

         curl https://img.ly/blog/ultimate-guide-to-ffmpeg/|sed 's/<div class=\"cke-overlay\">/<!--&/;s/<main class=\"main u-relative \">/-->&/' > 1.htm
         firefox ./1.htm
      
      Another way is to use the AMP URL:

         links https://img.ly/blog/ultimate-guide-to-ffmpeg/amp/
      
      AMP actually looks great in a text-only browser such as links.

      It may also be possible to remove a <div>-based cookie consent using a browser Add-On like uBlock Origin.

      If it were up to me, cookie consents would be done via HTTP headers. The user could simply set their client to send an HTTP header indicating no consent. Something like

         Cookie-consent: False
      
      I use a localhost-bound forward proxy to selectively send cookies where they are actually needed. Thus it is not browser-specific. It works with any client, e.g., netcat.
      • orliesaurus a year ago

        what browser (that is text-only) do you use? genuinely curious to try it myself on my site!

    • ryandrake a year ago

      I 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 a year ago

      How long before browsers have a built in setting to automatically tell these cookie prompts "essential cookies only please"?

      • pessimizer a year ago

        Never. 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 a year ago

          opposing proof: Brave does.

          • GeorgeWBasic a year ago

            I sure would love it if they came up with a way to block those "intent to leave" popups too.

    • emsixteen a year ago

      If they're running anything tracking related then they need to gather consent. It's not complicated.

  • vesinisa a year ago

    Think 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 a year ago

      Thanks, removed the check, it was indeed just awkwardly worded.

  • throw7 a year ago

    An 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.

    • astrange a year ago

      You 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 a year 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 a year ago

          Well, I haven't tried it recently, but it's probably rounding your start time to the nearest keyframe.

    • Melatonic a year ago

      I 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.

  • vovi-z a year ago

    I'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.

  • rogerz46 a year ago

    Thank you so much for sharing this and really help my daily tasks. I can automate them in CLI instead of GUI now.

  • antihero a year ago

    This is absolutely fantastic, thanks!

  • chewz a year ago

    Thank you...

ranting-moth a year ago

Not 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 a year ago

    Its reading time, not understanding time :P

    • buss_jan a year ago

      There 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.

  • flumpcakes a year ago

    There kind-of is a table of contents.

    If you're on a desktop computer then the top right has a floating grey "On this Page" which lists the section headers.

    There's no numbering or sigils, which might make it hard to use effectively as a TOC.

  • tambourine_man a year ago

    Your criticism seem extremely polite for a ranting moth :)

  • christiangenco a year ago

    Perhaps you'd like a word count instead?

    I believe the way all of these reading time estimates are calculated is a simple `wordCount / averageWordsPerMinute`.

  • madeofpalk a year ago

    Estimate reading time from words per minute. Here's an NPM package that'll do it for you! https://www.npmjs.com/package/reading-time

    • crispyambulance a year ago

      I don't get why reading time is even a thing.

      One can simply look at the right-hand-side of their browser window and see the scrollbar height to gauge "accurately enough" whether it's long or short.

      More to the point, I would expect anything purporting to be an "ultimate" guide to ffmpeg to be a massive time sink that simply can't (and shouldn't) be ingested in one sitting. It's either going to be incredibly dense or it's going to leave out innumerable details, leaving many things implicit. Don't get me wrong, there is nothing wrong with those approaches, but it means that "how long" it takes to read will depend on the reader and what they actually end up reading.

    • iso1631 a year ago

      Is that estimate really accurate to 2% that using 58 minutes rather than "about an hour" implies?

      • madeofpalk a year ago

        I guess it is easier, dev wise, to round a WPM-calculation than do fuzzy duration logic. I wouldn't stress too much about it

        • iso1631 a year ago

             if (mins < 4) return "a couple of minutes"
             if (mins < 8) return "five minutes"
             if (mins < 12) return "ten minutes"
             if (mins < 18) return "quarter of an hour"
             if (mins < 25) return "20 minutes"
             if (mins < 40) return "half an hour"
             if (mins < 50) return "45 minutes"
             if (mins < 70) return "about an hour"
             if (mins < 100) return "hour and a half"
             if (mins < 250) return "a couple of hours"
          • Karellen a year ago

            Wouldn't it be more useful to overestimate, rather than underestimate?

            Also, is the "couple of hours" estimate being off by more than a factor of 2 a typo, or are you just trolling at that point?

            • madeofpalk a year ago

              or just use the minutes value.

      • johannes1234321 a year ago

        But I don't have one hour!

        I wonder if that is a purposely value, trying to use the same psychology as Supermarkt prices, where they say "0.99" rather than ""1.00"?

        In my opinion the right approach however is to have a clean layout, where my scrollbars gives me a good estimate on the length, so I can make my estimate based on my reading speed and experience. But yeah, ads and other stuff make that of course impossible.

    • tgv a year ago

      That's pointless. Then just publish the number of words or (A4) pages.

      • thrdbndndn a year ago

        I don't find it's pointless. Sure, in this particular case (a very long time for something meant to be very long) is probably, but a "3-min read" note have made me read lots of articles I typically won't.

        And it's definitely better than "number of words" or "A4 pages", since I have no idea how fast average person reads.

aargh_aargh a year ago

There's a myriad of ffmpeg examples on the web so I wish there was something like 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.

xenodium a year ago

While, 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

stefanvdw1 a year ago

I can only recommend this tool to help you build pipelines in a visual way: https://ffmpeg.guide

Not affiliated, just a happy user

miles a year ago

Thanks 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 . 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

  • andirk a year ago

    Put 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 :)

scoutt a year ago

A 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!!

  • onion2k a year ago

    My 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.

djha-skin a year ago

I'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 a year ago

    I 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 a year ago

      This 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 a year ago

      I'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".

  • Melatonic a year ago

    Doubtful. Just probably not out of the box.

    This will take longer obviously but a two step process where you export to an image sequence (like say 16 bit tiff) is a pretty fool proof way to retain colour information. And true pro industries like the VFX industry pretty much exclusively use image sequences (because they are just superior in everyway). Although they would be using either DPX or EXR sequences.

hugs a year 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.

  • Trixter a year ago

    codec is coder/decoder. Not sure where you're getting your other definition. "codec"s are required to both create, and play back, a file with a certain compression algorithm.

    • hugs a year ago

      The other definition was a quote from the FFmpeg guide this thread is about.

DrBazza a year ago
  • rurtrack a year ago

    I'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 a year ago

      I think I might have a use case for that, I'd no idea that it was now available in wasm!

  • sorenjan a year ago

    That's really cool! I wonder if you could stream to a Chromecast?

slhck a year ago

This 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.

blueflow a year ago

This is a brilliant way for people to avoid reading the official ffmpeg manpages.

  • moffkalast a year ago

    One day the imperium of man will be finally defeated.

shantnutiwari a year ago

Sorry, 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

bool3max a year ago

Slightly 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.

  • cm2187 a year ago

    Were you working on files on a NAS? Often faster to copy locally, run ffmpeg, copy back to the NAS for some reason. Faststart flag transcodes the file twice. Otherwise can't think of any reason.

    • bool3max a year ago

      No, it was on a local harddrive.

filmgirlcw a year ago

I 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/

apocalyptic0n3 a year ago

I 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.

cyborgx7 a year ago

This 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.

  • leokennis a year ago

    While I agree with you that ffmpeg is hard to fully utilize in its current form, how do you design a "wrapper" for a CLI tool with 68,915 (I could be off by a few) parameters?

    There's only one way to manage that, and that is to hide some options and functionality. Then it stops being an ffmpeg GUI, it starts becoming a "video transcoding application" (or an "audio grabber application "or a "subtitle insertion application") with ffmpeg as its backend.

    See a similar thing for openssl here: https://smallstep.com/blog/if-openssl-were-a-gui/

    Maybe someone can build a very specific AI that generates ffmpeg commands for you, based on its man page and what you input as free text?

  • staindk a year ago

    I'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

  • ythrowawa123457 a year ago

    There 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 a year ago

      Digging 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

  • johnnymorgan a year ago

    There are GUIs for ffmpeg out there, I haven't used one in awhile but they exist

INTPenis a year ago

Hey 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.

sylware a year ago

ooof! 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).

narag a year ago

The 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.

  • Wowfunhappy a year ago

    Are 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 a year ago

      See also: Cutting the videos based on start and end time using ffmpeg

      https://stackoverflow.com/a/18449609

      • narag a year ago

        Thanks, 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.

        • pessimizer a year ago

          https://superuser.com/questions/138331/using-ffmpeg-to-cut-u...

          Looks like the ordering of the parameters makes a difference.

          • narag a year ago

            That seems another different issue. The problem, as Wowfunhappy explained, is that the codecs compress the frames making a diff with the previous frames. So if you start in a frame that depends on other frames that you don't want to include in the clip, there's information missing. The result is that the clip starts playing the sound, but with all-black video for a few seconds.

            In the previous link there are a couple of solutions that might work. One is "recoding", that's somehow ambiguous: could be understood as changing the codec, but also making a new compression from the decompressed frames.

            I have the program in another computer so I can't test it now, but I certainly will.

            • pessimizer a year ago

              I understand the problem.

              >Also note this important point from that page: "If you use -ss with -c:v copy, the resulting bitstream might end up being choppy, not playable, or out of sync with the audio stream, since ffmpeg is forced to only use/split on i-frames."

              > This means you need to re-encode the video, even if you want to just copy it, or risk it being choppy and out of sync. You could try just -c copy first, but if the video sucks you'll need to re-do it.

              From the link.

              -----

              edit: if it aids understanding, I think i-frame means "interpolated frame" i.e. frame that depends on the previous and next frames.

              edit2: and "-c:v copy" means don't transcode (or "recode" as you say) the video, but simply copy it.

    • narag a year ago

      I didn't use anything that was not obviously neeeded. What you say about previous frames was also my guess, but that doesn't seem a reasonable behaviour to me.

      If ffmpeg needs more information, it should take it. That's what the logic in the parameters say. Instead of that it forces me to include some seconds that I don't want in the clip or blackening the video, both of them useless results.

      • Wowfunhappy a year ago

        Well that's why I thought you must have specified `-codec copy`. If you force ffmpeg to not re-encode the video, and also cut the video, it will perform that impossible action as best it can.

        But I legitimately don't know why that would happen otherwise. Usually it defaults to re-encoding when I use it.

        • narag a year ago

          It's been a couple of years at least, so it isn't fresh. I don't remember anything about dealing with codecs. Anyway, it seems from all the links that using some re-encoding option will fix it. Thanks again!

  • sylware a year ago

    GUI frontend to command line is "why" the command line output should be machine parseable, I think this is true for most of relevant ffmpeg output.

  • hnarn a year ago

    handbrake-cli does this well but the syntax for begin and end timestamps is pretty confusing when combined

jokoon a year ago

I 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).

oleg_antonyan a year ago

Is there similar guide but for developers, describing how to use libav, up-to-date example audio player, etc?

tartoran a year ago

What 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.

elAhmo a year ago

Maybe slightly unrelated, but I really like the presentation, fonts and design of your website. Could you share more about that?

c120 a year ago

Get 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...

rjzzleep a year ago

Not 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?

NaturalPhallacy a year ago

Anyone 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.

Yeahsureok a year ago

Could I recommend a table of contents?

It looks great, bookmarked.

  • defrost a year ago

    A 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.

    • TehShrike a year ago

      But 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 a year ago

      I did not notice that until you said it.

frog360 a year ago

I recently had to use ffmpeg, and I ended up scrapping it in favor of sounddevice in python. Thanks for the helpful info

nintendo1889 a year ago

FFmpeg has the longest man page in existence by far.

zerop a year ago

Is there a good FFmpeg front end?

  • apocalyptic0n3 a year ago

    Handbrake uses ffmpeg in the background (a forked version if I recall correctly).

  • pessimizer a year ago

    I'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.

sfmike a year ago

is there currently a way to remove floating watermarks with ffmpeg?

truth_seeker a year ago

well written blog. thanks for sharing

nubero a year ago

That article is a far longer joke than the two word classic “Desktop Linux”. Seriously though: good software has a user interface.

  • nubero a year ago

    Just 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…