There are options in the field of streaming video.
If you’re a relatively technical person and just need a simple tool to broadcast a live stream, this post is for you—but, if you’re a professional broadcaster with an online video platform, this post is also for you. The web hosts some quality free and open-source tools out there that could either serve as a cost-effective streaming solution or augment all types of broadcasting toolkits, and FFmpeg streaming is one of them. Head on to the sections below and we’ll give you a full picture of what FFmpeg does and why you might want to use it.
- What is FFmpeg Live Streaming?
- How to Stream with FFmpeg
- The Benefits and Capabilities of FFmpeg Streaming
- Getting Started Using FFmpeg (download & installation guide)
What is FFmpeg Live Streaming?
FFmpeg is a command-line tool for converting audio and video formats, and it can also capture and encode in real-time from hardware and software sources. FFmpeg streaming, as you might now guess, is incorporating FFmpeg into your live streaming workflow. It’s a whole suite of tools with significant capabilities for live streaming, it can work with video, audio, and images in almost any format used over the past 20 years and is a free and open-source project meaning it can be downloaded and used at no cost.
FFmpeg describes itself as “the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.”
That’s a bold claim, but can it hold up? Well, with a little bit of a disclaimer, it turns out FFmpeg is a fairly powerful tool.
As far as the disclaimer—the main thing to note is that when we referred to FFmpeg as “for relatively technical” people above, it’s because runs on a command line interface (CLI). That’s right, NO graphical user interface (or GUI); you’ll have to type with a keyboard like it’s the 20th Century or something. However, if you’re able to overcome that hurdle to entry or are even already comfortable with manually typing commands, you’ll discover that FFmpeg can provide you with a wide range of functions for live streaming. This is not a tool for the complete beginner, though. If you’re just getting your feet wet streaming online content, there are other freeware solutions with a GUI that might be a better option to start.
Get Started with Kaltura TownHalls
How to Stream with FFmpeg
Or to accurately address FFmpeg streaming, the better question to ask is “What do you want to do with your video stream?”
Using FFmpeg (once it’s installed) will vary by operating system. Windows users will have to open the Command Prompt window (Windows + R, type “cmd” and press Enter); Mac users need to access Terminal—find the app on your Dock or go into /Applications/Utilities and double click Terminal; and Linux users will need to open up the terminal or shell to get a command prompt—find the launcher or (on most systems) use the keyboard shortcut Ctrl-Alt-T. (Linux users: you are probably already a lot more comfortable using the command line!)
FFmpeg is capable of supporting HTTP live streaming output. It can convert to different codecs and file formats (in other words, encode). It can also receive from a source, such as live or UDP, and then transcode and rebroadcast the stream.
Per FFmpeg’s wiki, the software does not come with a built-in server. Of course, if you’re already set up with a media server solution that’s not a concern, and you can focus more on how FFmpeg can aid your ingest stream.
As a contrast to your GUI-based Audacities and Handbrakes of the world, FFmpeg can also be used as a very quick and easy tool to convert files without navigating a lot of potentially confusing menus. You can even use it to make animated GIFs. These features are not necessarily an essential aid to live or on-demand content streaming but they will be a plus for your ingest process.
Also per the project’s streaming guide, FFmpeg can stream in a few key ways: streaming to a chosen server which will re-stream the content to multiple clients, or a single-destination receiver, or potentially directly to a multicast destination.
In the same way FFmpeg claims to be able to “play pretty much anything that humans and machines have created,” the majority of servers and server solutions available today (including Kaltura) can receive from FFmpeg and re-stream to multiple clients.
Setting your stream is the part that will require a bit of technical know-how. Essentially you’ll need to be familiar enough with the framework to be able to type out the commands and flags that will connect to your server and tell the stream how to behave.
Here’s an example posted in FFmpeg’s guide of how to stream to the popular streaming service Twitch.tv using RTMP protocol :
ffmpeg -f x11grab -s 1920×1200 -framerate 15 -i :0.0 -f pulse -ac 2 -i default -c:v libx264 -preset fast -pix_fmt yuv420p -s 1280×800 -c:a aac -b:a 160k -ar 44100 -threads 0 -f flv “rtmp://live.twitch.tv/app/live_********_******************************”
Here’s an example of FFmpeg streaming from one computer to another—there are a few different ways to accomplish this, but in this case, point-to-point streaming is set up and the host is the receiving IP. The stream could be received using VLC or FFmpeg from the port.
ffmpeg -i INPUT -acodec libmp3lame -ar 11025 –f rtp rtp://host:port
So, this gives a sense of what kind of user input will be required for your FFmpeg stream. If you’re unfamiliar with concepts like “flags” and “ports” then exercise caution approaching FFmpeg… however with some time and more exposure to IT networking fundamentals, it will become possible to master the framework and you may ultimately find it to be an invaluable encoder and “Swiss Army knife” style tool.
To get a stream going the first step is to download FFmpeg—we’ll cover this more in the final section of the post, below. Their site also offers extensive documentation to help get you up to speed with the tools.
The Benefits and Capabilities of FFmpeg Streaming
FFmpeg delivers a wide range of options. It’s compatible with many audio and video inputs that are available for computers including webcam, USB microphones, and capture-card-based cameras. It’s also well equipped to output RTMP streams to your video streaming platform of choice—it will accept your login to permit you to stream directly to the destination, giving simple live streaming functionality via CLI.
FFmpeg streaming is also useful when mixing live productions. If you’re a broadcaster with a complex, multicamera live set-up you can set up one workstation for capturing feeds from different cameras. An engineer at this “control room” set-up can mix the video in real-time and output it to another workstation that is running FFmpeg. The FFmpeg workstation broadcasts the live streams as a final result, dividing the considerable processing load between multiple computers.
Additionally, FFmpeg has a significant number of tools for live streaming. As we’ve repeatedly pointed out, FFmpeg works as both an input recorder and an encoder and converter. However, its capabilities also include adjusting audio and video bitrate; audio volume adjustment and the ability to remove audio from or link audio to a video file; mapping a mono audio source to stereo channels; cropping, scaling, or rotating video files; and other useful audio and video editing functions such as denoising, blurring, color conversion, frame-extraction, and letterboxing. Basically, it can handle most video processing tasks that are critical to processing, compression, and delivery workflows.
Finally, it scales well across varied hardware specifications, and since the framework is open-source features are always being added regularly. Not only that, since anyone can contribute to it you can modify the source and extend its capabilities to better suit your own needs.
Getting Started Using FFmpeg
As you know from the above “How to Stream” section, the first thing to do is download the latest build of FFmpeg.
The installation of FFmpeg, just like using it, will vary by operating system.
Windows is probably the OS that lends itself to a mostly point and click installation: go to FFmpeg’s site and download your build and make sure you have an app for decompressing files, such as WinRAR or 7Zip, and it should be easy to extract the files to your system. If things get confusing, here’s a wikiHow guide.
A Mac OS installation is a more involved affair, taking you directly to the Terminal and command line. It also requires the Homebrew package manager utility for installing package files and making sure the Command Line Tools for developers are installed on your Mac—like we mentioned, this is not a tool for complete beginners. There are other ways to build the FFmpeg tools on your Mac system, such as compiling yourself, but Homebrew is probably the most “no mess, no fuss” installation method and there are easily discoverable step-by-step walkthroughs for it online.
Finally, for Linux users, there are packages of the FFmpeg site suitable for various Linux distributions (Ubuntu, Red Hat Enterprise, etc.) Chances are if you’re using Linux as your OS, you know what you’re in for as far as complexity in installing a multimedia framework. A detailed Linux installation guide is perhaps outside the scope of this article (especially as it may vary some by distro), but there is ample support available on the internet via the large, passionate, and extremely technical Linux community, so check around your favorite resources and limber up your typing fingers for a lot of “$ sudo apt update”.
FFmpeg is a free and open-source “made-for-everyone” tool that, due to its relative technical complexity, isn’t actually for everyone. Still, if you’re already proficient with command line operations or are willing to take on a learning curve, this is a highly useful framework of video and streaming tools that will augment any professional broadcaster’s toolkit. We also hope that this post sparks readers’ curiosity to learn more about CLI tools, open-source, and the other technologies underpinning the software and networks the world uses every day. While nearly anyone can find an app to live stream camera video to the web, the topic and technical aspects of streaming are deep enough to support long-term active learning, leading to technological excellence and mastery.