Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Technology IT

In Praise of FFmpeg (drewdevault.com) 81

Drew DeVault, prolific FOSS blogger and hacker behind SourceHut, Sway, wlroots, and many other projects, writes in a blog post: I have relied on ffmpeg for many tasks and for many years. It has always been there to handle any little multimedia-related task I might put it to for personal use -- re-encoding audio files so they fit on my phone, taking clips from videos to share, muxing fonts into mkv files, capturing video from my webcam, live streaming hacking sessions on my own platform, or anything else I can imagine. It formed the foundation of MediaCrush back in the day, where we used it to optimize multimedia files for efficient viewing on the web, back when that was more difficult than "just transcode it to a webm."

ffmpeg is notable for being one of the first large-scale FOSS projects to completely eradicate proprietary software in its niche. Virtually all multimedia-related companies rely on ffmpeg to do their heavy lifting. It took a complex problem and solved it, with free software. The book is now closed on multimedia: ffmpeg is the solution to almost all of your problems. And if it's not, you're more likely to patch ffmpeg than to develop something new. The code is accessible and the community are experts in your problem domain.

ffmpeg is one of the foremost pillars of achievement in free software. It has touched the lives of every reader, whether they know it or not. If you've ever watched TV, or gone to a movie, or watched videos online, or listened to a podcast, odds are that ffmpeg was involved in making it possible. It is one of the most well-executed and important software projects of all time.

This discussion has been archived. No new comments can be posted.

In Praise of FFmpeg

Comments Filter:
  • by flyingfsck ( 986395 ) on Monday October 17, 2022 @03:27PM (#62974563)
    I think both ffmpeg and gstreamer are quite indispensable nowadays.
    • Re:Gstreamer anyone? (Score:4, Informative)

      by serviscope_minor ( 664417 ) on Monday October 17, 2022 @04:45PM (#62974793) Journal

      Gstreamer only because people inexplicably use it rather than ffmpeg directly. It's functionally useless until you have the ffmpeg-gstreamer plugin installed.

      • Gstreamer as it's the basis of the only really good UPnP audio renderer (gmediarender) available for headless linux based boxes. But ffmpeg is indeed superb and indispensable and a thing of wonder.

    • by piojo ( 995934 )

      I'll bite.

      Ffmpeg is for analyzing and extracting streams, or encoding and them and putting them in containers. It cuts, joins, rotates, crops, and applies arbitrary filters. It can encode down to a given bitrate, or applying specific preset techniques.

      What is Gstreamer for? Realtime encoding (streaming)?

      Just a guess: it does less than ffmepg but with better interoperability. Ffmpeg doesn't seem to have an API, since every frontend I know of just invokes the executable. The command invocation isn't even stra

      • Re:Gstreamer anyone? (Score:5, Informative)

        by Omega Hacker ( 6676 ) <omega@omega[ ]net ['cs.' in gap]> on Tuesday October 18, 2022 @11:55AM (#62977237)
        GStreamer is an entire ecosystem with literally thousands of plugins that can process a wide range of streaming information. The ffmpeg plugin to GStreamer happens to provide a means for processing most compressed audio, video, and container formats. Other plugins provide functions outside the scope of ffmpeg. There are nonlinear editing subsystems, video analytics, and many other capabilities. For an extreme example look at GstLAL, a set of plugins that process absurdly large amounts of data coming from sensors at LIGO, which was used to sift through the raw data to identify candidates for events that resulted in the Nobel Prize-winning detection of gravity waves. Yes, it's also used for realtime video streaming, such as the Japanese robot that flew on the ISS and used GStreamer to transmit teleoperation video. More pedestrian uses include basic video decoding, but because plugins have a well-defined API, in many cases GStreamer plugins are the only option available to perform hardware-assisted encode/decode/etc on a given embedded chip. Yes, you could use the ffmpeg plugin, but that only runs on the CPU, and major manufacturers (e.g. Texas Instruments, Rockchip, etc.) write all their own plugins to drive the silicon they produce.

        FWIW I invented GStreamer in the first place.
        • by piojo ( 995934 )

          Thank you, that helps clear up my ignorance! Indeed I can't imagine using ffmpeg for the sorts of things you described. Ffmpeg seems to be more of a pocket calculator--very easy to use for a relatively narrow use case.

        • by oddtodd ( 125924 )

          How is this not modded +11 Extremely Informative?

  • patents (Score:2, Interesting)

    by pruss ( 246395 )

    I'd love to be able to use ffmpeg for video conversion, but since I'm in the US, I worry that I'd be infringing on patents, so with regret I use (licensed) Adobe stuff instead. (Yes, I know that no one will come after me for private non-commercial patent infringement. But my moral beliefs require obedience to the law when the law is not fundamentally unjust.)

    • Re:patents (Score:4, Insightful)

      by XanC ( 644172 ) on Monday October 17, 2022 @03:36PM (#62974609)

      Moral qualms about patent infringement regarding your own personal use? That is out there.

      Let's say somebody had a patent on some aspect of an electronic picture frame. If you implemented such a "picture frame" using a Linux box and an old display, would you say you have violated some moral code?

      • by pruss ( 246395 )

        It depends. I might be willing to judge for myself that a picture frame patent is invalid on grounds of obviousness, and any courts that ruled the patent valid were just interpreting the law wrongly. But the compression algorithms for video are not obvious in the same way.

        Almost two decades ago, I actually signed onto an MPEG LA license so I could legally use xvid for personal projects. The license requires no royalties under some number of encoder/decoder units (I think it's something like 10,000 or 100,00

        • Correct. A patent is effectively "a license to sue".

          It is up to the patent holder to take a suit against anyone who infringes so in that regard it is more like a civil suit than a criminal offense.

    • by Kremmy ( 793693 )
      I would recommend installing the update to your moral code that identifies software patents themselves as unjust law.
      • by Anonymous Coward

        I would recommend installing the update to your moral code that identifies software patents themselves as unjust law.

        Yeah cool let's just pick and choose which laws we want to follow, the ones we don't like we'll just deem "immoral".

    • Re:patents (Score:5, Funny)

      by Jesus Q. Christ ( 6408050 ) on Monday October 17, 2022 @03:47PM (#62974649)

      But my moral beliefs require obedience to the law when the law is not fundamentally unjust.

      In this case, you have my permission, my son. I really couldn't be bothered to give a fflying ffuck about this.

    • Re:patents (Score:5, Insightful)

      by K. S. Kyosuke ( 729550 ) on Monday October 17, 2022 @04:33PM (#62974771)
      You believe that patenting mathematics is "not fundamentally unjust"!?
      • You believe that patenting mathematics is "not fundamentally unjust"!?

        Seeing as how **anything** can be described with mathematics my threshold is likely different from yours. Do I think one-click shopping should be patentable? No. A novel video compression algorithm? Possibly. Do I think those being broken down to ones and zeroes matters in the slightest? No.

        • how **anything** can be described with mathematics

          Except it's not about "describing X with mathematics". It's about certain things literally being mathematics.

    • Re:patents (Score:4, Insightful)

      by thegarbz ( 1787294 ) on Monday October 17, 2022 @06:04PM (#62975009)

      Yes, I know that no one will come after me for private non-commercial patent infringement. But my moral beliefs require obedience to the law when the law is not fundamentally unjust.

      Patents exist to protect the commercial interests of the holder. There is nothing morally wrong about infringing patents privately (note I said Privately, not no-profit). Private patent infringement is insanely prolific and yet private people getting dragged to court is vanishingly rare (largely because the potential payout of private scale infringement is less than the cost of bringing a lawsuit in the first place).

      If you support the suppression of private, non-commercial use of publicly published methods and designs, *that* my friend is morally apprehensible.

      • No, the reason "private patent infringement" is prolific and not persecuted is because it's not a real thing. A patent is a deal struck between the government and an inventor. The inventor gets to try to profit off the idea for a period of time while the government provides protection. But part of that deal is that the invention must be made public, and anyone else is allowed to now copy that invention for personal use (not for profit of course). That is literally part of the deal. That's why patents are p
        • and anyone else is allowed to now copy that invention for personal use (not for profit of course).

          False. Information is provided so you know what *not* to do. Legally personal use is still patent infringement, there is no language in patent law that applies it exclusively to commercial use or carves out exceptions for private use. The confusion is that practically it is simply not enforced.

          Here's the exact language from Section 35 Code 154 (note the use of commas showing that "offers for sale" is not required, the clause applies simply for making something or using something):
          makes, uses, offers for sal

          • Speaking about "exact language", what you cited talks about "the right to obtain a reasonable royalty" from some people. Not that those "some people" can't do the things for which that right exists. If it meant "you're violating the law until you pay for doing any of the things in that list", then virtually all of US would be violating the law.
    • my moral beliefs require obedience to the law when the law is not fundamentally unjust.

      Bro, patent and copyright law, as they are today, are fundamentally unjust. The social contract has long been broken.

    • How is that law not fundamentally unjust? It disproportionately rewards the owner of an idea and retards progress in the art simultaneously

    • > with regret I use (licensed) Adobe stuff instead ... my moral beliefs require obedience to the law

      Adobe demanded Dmitry Sklyarov held in prison "for" describing their weak security, a blatant kidnapping conspiracy in violation of the First Amendment, the highest law in the land.

      Paying Adobe is far more of a moral problem than wondering if ffmpeg violates any patents that should have been granted (despite a lack of prosecution).

  • Container and Container's streams lay hid in night: ffmpeg said, let ffprobe be! and all was light
  • by unami ( 1042872 ) on Monday October 17, 2022 @03:41PM (#62974631)
    most common tools used tools in the video industry, like Avid, Adobe's suite, Davinci Resolve, Final Cut, Cinema4D, Nuke,... don't use ffmpeg, afaik. Sure, you'll use it occasionally, when you are technical inclined enough tonuse the command line, which a lot of creatives aren't. e.g, when a client gives you a video in some extra exotic, nasty codec you need to transcode or you install it with a cheap GUI for it. It's undoubtetly great, but "If you've ever watched TV, or gone to a movie, or watched videos online, or listened to a podcast, odds are that ffmpeg was involved in making it possible." might be stretching it a little much.
    • by clawsoon ( 748629 ) on Monday October 17, 2022 @04:07PM (#62974695)

      It has certainly been used on all the render farms I've touched over the past 20 years. Love it or hate it - sometimes both at the same time - it's the most efficient way to process large volumes of frames and video automatically in a production environment.

      I'm sure there are plenty of shops that don't use it at all, but then you find out that they sent half-a-dozen shots to an FX house for cleanup, and that shop didn't use ffmpeg directly on the footage, but they do happen to use Shotgrid for production management, which uses ffmpeg on the backend to generate web previews... and there you are, ffmpeg was involved in making it possible.

    • by sjames ( 1099 )

      FFmpeg isn't just a CLI utility, it is a library with a CLI front-end.

      Editing is just one step of the process. Trnsport including OTA broadcasting also involve compression in various forms.

      • I think the point the OP was making is that commercial software used in video production usually uses licensed codecs and libraries, not ffmpeg. Companies involved in broadcasting will definitely use hardware codecs which are licensed. Companies involved in streaming largely license codecs and write their own to suit their specific hardware in the name of efficiency (or in some cases even design their own hardware ASICs).

        Same with playback software where most software and OSes ships with a subset of license

        • But it is used more than they think, as a linked library. For example, Adobe has it in their 3rd-party license notice for their products.

          • But it is used more than they think, as a linked library. For example, Adobe has it in their 3rd-party license notice for their products.

            Indeed it's linked in quite a bit of 3rd party software. But the statement in TFS is not correct. Adobe may have ffmpeg in their 3rd party license notices, but Adobe Media Encoder does not use ffmpeg for any commonly used formats in favour of their own licensed codecs. Ffmpeg is largely used by AME to read non-standard material and convert it to something else. That's in Adobe's own manuals. Can't add a file to Premier? Open it in AME and convert it to raw or something really high bitrate.

            But if you're a vi

    • by Anonymous Coward

      It's not an overstatement at all. Some of those tools turn to commercial codec manufacturers like MainConcept. Often better quality (visually and in compliance), faster and no OSS obligation, plus customer care services.

    • by Kremmy ( 793693 )
      I got curious how wrong that was, take a look at this. [adobe.com]
      • by Anonymous Coward

        Doesn't prove anything. The commercial vendor (mentioned elsewhere) that provides AVC and HEVC codecs to Adobe isn't listed, yet you'll find their libraries if you dig through a Premier Pro or Lightroom installation for example. You have no idea how they're using FFmpeg either - perhaps only for ingest of certain lesser formats or demuxing (although not MXF based on the MOG reference). FFmpeg certainly won't be used for specialized professional camera cases that might include HEVC 4:2:2 for example, whic

  • This statement is not true at all: “Virtually all multimedia-related companies rely on ffmpeg to do their heavy lifting.“. These are the services that most companies that don’t do in-house / hardware encoding rely on.

    Neither AWS Media Convert or Bitmovin use ffmpeg for encoding or packaging. ( Although it is used for decoding various input files. )

    • so you mean they're using it in a fundamental step in their business? tell us again about how they're not using it to do "heavy lifting"

  • by Rosco P. Coltrane ( 209368 ) on Monday October 17, 2022 @04:01PM (#62974681)

    Real power users do their video editing in Emacs.

    • Real power users do their video editing in Emacs.

      I'm a *long* time Emacs user and have actually used it to edit strings in executables and the "magic" line various binary files ...

  • If I record a 45 minute lecture on my Mac using the built-in recording application (I have a M1 air) I get a video in excess of 1 GB. ffmpeg reduces that by an order of magnitude, with a very simple terminal command. And I'm not an expert on video editing or using ffmpeg at all -- I bet others could do better.

  • Depends how heavy (Score:5, Informative)

    by fortunatus ( 445210 ) on Monday October 17, 2022 @04:22PM (#62974735)
    I work for a $250+M/yr corporation specializing in audio/video stream processing for television and online streaming industries. We use ffmpeg, but not for our "heavy lifting". Our core codec products still undergo continuous improvement by a staff of specialists, and it is the difference we can make w/respect to our competitors that keeps us in business. And frankly, when it comes to achieving a quality compression at challenging bitrates, ffmpeg isn't even on the playing field. That said, we do use a couple of ffmpeg's capabilities in products, and ffmpeg is all over the laboratories to help with analysis and monitoring. Ffmpeg is indeed indispensible. But as far as "completely eradicating proprientary software in its niche"? Our customers say otherwise.
    • Speed, HRD compliance, standards compliance, professional camera compatibility, OSS obligations, etc, all points where FFmpeg (or rather the codecs it uses) falls down to some degree. Some of the codecs like x264 have excellent quality, but aren't so fast, and others like x265 require a much higher bitrate to achieve the same quality as the commercial codecs. Need help tuning the codec or advice about a deployment or integration? Some of the commercial vendors have that too.

    • by NuttyBee ( 90438 )

      At my somewhat less profitable employer, we do not use ffmpeg in our end products. We write our own encoding algorithms, we have a barrage of picture processing mechanisms that enable a picture to just look better at a given bitrate. ffmpegs output does not come close to what we produce. You can throw it at a PSNR or SSIM or whatever metric you want, we will win.

      ffmpeg is used on the dev side, and I use it to slice up video on my laptop, just because I don't always want our software on my laptop.. (I did

      • Would you be able to name your company? Struggling to find quality live software encoders with SCTE and optionally NDI support and MPEG TS output, short of AWS MediaLive
      • Would you be able to name your company? Struggling to find quality live software encoder with SCTE and (optionally) NDI support and MPEG TS output, short of AWS MediaLive.
      • Very interesting comment! Do you already use or are planning to use AV1 in your company?
    • Re:Depends how heavy (Score:4, Interesting)

      by Kremmy ( 793693 ) on Monday October 17, 2022 @07:08PM (#62975213)
      It sure sounds like your company relies on it in a way where it would have to create it if it wasn't already available.
    • Any chance you could mention the name of the company? We're desperate for a quality software encoder (television industry)
  • FFmpeg - it does much more than what the name suggests.
  • by lsllll ( 830002 ) on Monday October 17, 2022 @05:09PM (#62974859)

    From a professional perspective, I've been using ffmpeg (and before that transcode and ffmpeg) to record audio/video in a medical school's 4 lecture halls in 30-minute segments, every day, for about 14 years straight and then later intermingling the recorded videos with the room scheduler to deliver automated videos of the lectures to medical students. With the exception of occasional video being lost (probably because of drivers locking up the feed), it has been pretty solid. Whatever the needs are (resizing, clipping, conversion, audio extraction, superimposing, etc), the winning factor is that EVERYTHING I need to do I can do on the command line and in an automated fashion. From that point, ffmpeg is what makes it a winner for me.

    From a personal perspective, I played a lot more with it when I used to carry around an iPod 5, an Argos, and stuff from before. But any time I need to do something with a video or audio file, I usually start (end usually end) with ffmpeg. It is truly a great, versatile piece of FOSS.

  • But, regardless, ffmpeg is certainly a great tool that makes a lot of my personal projects much easier (or maybe even possible at all).

  • Not sure whether it's ffmpeg to blame, or Chrome/Firefox/Edge/MediaPlayerClassic, or a mix, but there's something very wrong is something as trivial as this is broken:

    Compare:
    ffmpeg -f lavfi -i color=0x008000:s=400x576 -crf 0 -vcodec libx264 -t 5 -y out1.mp4
    ffmpeg -f lavfi -i color=0x008000:s=400x578 -crf 0 -vcodec libx264 -t 5 -y out2.mp4

    At least on my setup, the green is darker than it should brighter if the height is 578 or greater.

    Makes the whole format look like a complete mess.
  • by caseih ( 160668 ) on Monday October 17, 2022 @07:01PM (#62975193)

    According to an interview with one of the Ingenuity team members, ffmpeg is on the Ingenuity helicopter on Mars and is regularly used (via shell scripts uploaded from earth) to process image frames into compressed video sequences which are then downloaded to the Perseverance rover and eventually sent down to Earth. I assume that full frames get downloaded eventually as well. The ffmpeg videos are probably more for previewing the footage. Pretty neat how they utilize Linux and all the bundled utilities to great effect, including remote shell access.

    • Of course. When spending $2.4billion you don't want to waste needless dollars on an MPEG-LA license ;-)

  • So how do I rip all my DVD's to ffmpeg? A 5 TByte drive should be sufficient, I only have a few hundred. Can it be used for just audio too?
    • ffmpeg is a program - not a format.
      you can't rip a DVD to a program.
      you can however use a program to rip a DVD.

      no ffmpeg can't "rip" a DVD - just encode.
      yes it can obviously encode to audio as well.

    • Considering the effort required, put them in a box in the basement and download the movies. That work was done already.
  • It's dangerous if everyone relies on the same single point of failure. Diversification is stability.

  • ffmpeg has nice software architecture and programming style.

    Example alp.c
    https://git.ffmpeg.org/gitweb/... [ffmpeg.org]

To do nothing is to be nothing.

Working...