How to Use FFmpeg for Video Streaming

After I started self-monitoring, the importance of the recording tool increased dramatically and I encountered more and more problems.

Since I was recording mainly for self-monitoring, I didn’t need a very high frame rate, or even a lower one, and the resolution didn’t have to be the same as the screen, so I could see what I was doing. Initially, I used the free and open source VLC, which is also the solution I used in my article. It can adjust the output video encoding, frame rate, and format, but it’s a pain in the ass to operate, and it can’t record the screen and camera at the same time, and it’s easy to crash when you pause the recording.

Then I tried OBS, its recording function is extremely powerful, you can add any camera, text, image, etc., but the output limit is much, the generated video is too big. At the same time, OBS does not support the recording screen and live screen separate, and I usually used to work while live, which made me give up OBS recording screen.

Next, I came across 7.8k Star’s Capture, which has a high degree of freedom and can customize the overlay elements, however, the project has stopped updating in 2018, and I often encounter inexplicable errors when using it, which is very unstable.

The free one doesn’t work, so would the paid one be better?

I used Bandicam to record video for a week. Compared to Capture, Bandicam is much more stable, doesn’t crash suddenly, has noise reduction, and records speaker audio internally, but it loses the camera from time to time, making it impossible to record automatically.

Later, I tested several other screen recording apps.

Camera: Windows comes with the app, easy to record, but few output options and many limitations.
FlashBack Express: adjustable frame rate, mirroring, bokeh background, but the free version only supports recording within 2 hours.
Mirillis Action!: high frame rate game recording, automatic video splitting, custom overlay elements, but input frame rate can’t be adjusted freely, minimum 15 fps, 30 days trial period.
oCam: free but with pop-up ads and large output video.
ShareX: Free open source powerful screenshot software with screen recording function, adjustable encoding and frame rate, but only single screen recording or video recording.

I tried a total of 9 screen recording apps, and none of them were a good experience. The software generally had problems with inability to customize the screen, incompatibility, and low stability. In addition, the single recording time of the self-monitoring solution is over 12 hours, and the ideal frame rate (0.02 fps) is far beyond the minimum 15-30 fps limit of the application. Therefore, I needed to find another tool that was stable and compatible with a high degree of freedom and the freedom to customize the recording scheme, and finally found the common parent of these recording tools: FFmpeg.

Why Use FFmpeg
FFmpeg is a collection of libraries and tools for working with multimedia content such as audio, video, subtitles and related metadata, and is supported across Linux, macOS and Windows platforms. It provides a complete solution for recording, converting and streaming audio and video.

Almost all previous screen recording and video processing tools are based on FFmpeg, which does everything they do with great stability and compatibility. The only advantage of off-the-shelf video recording applications over FFmpeg is their beautiful interface and easy-to-use recording solution.

If you want to go beyond the limitations of the software and have the freedom to customize your recording solution to avoid inexplicable bugs, the more low-level FFmpeg is a more stable and effective solution. Command line recording looks complicated, but in fact, you only need to be familiar with a dozen parameters, you can customize your own recording solution, personal experience feels more simple than familiar with Bandicam’s software interface.

Here’s an example of my Windows desktop recording scenario. Specify a 2k area from multiple screens to record, add a 360p camera recording angle to the bottom right corner of the screen, and output the surveillance video at a frame rate of 0.02. Press q to stop recording.

If you read the FFmpeg documentation, you will find that this tool is extremely powerful, and that many tools that use FFmpeg do not maximize its functionality, trading off the ease of use of the software with more generalized features as much as possible. If, like me, you have a niche, or even a specific need, a packaged GUI application may not be able to handle it. This is where an underlying command-line tool like FFmpeg may be the only option, and if you use it, you will find that it is more stable and customizable while still being powerful. And if you get past the initial fear of the command line, it’s not that hard to understand and get started.

Moreover, FFmpeg has more functions than just screen recording, it also has many other powerful features such as continuous screenshot, video frame rate conversion and resizing, etc.

FFmpeg.guide is a tool to generate FFmpeg commands quickly, but after using it, it’s not practical at all, so the fastest way to start FFmpeg is to read the official documentation. The first phase will take some time, but as long as you customize the code you want, you can always use it afterwards, and the command will not change if the demand remains the same.

Of course, the purpose of this article is to share the extension of my monitoring myself and share the way to get started with FFmpeg recording, not to fully master it, so only the core code related to recording is introduced. If you need to, or recommended to study the official documentation, or follow me to do a try, there may be new gains.

0 likes
Prev post: A qualified entry-level iPad: Get started with the 2022 iPadNext post: AppUninstaller.com’s App Uninstaller announces new updates to uninstall the latest versions of Adobe apps