


In one of the guides I read a phrase that stuck with me.

The WCS server would receive an empty stream. I tested different Windows drivers and different desktop versions of Ubuntu, but all of it was in vain: I checked the FFmpeg keys over and over, I even found an alternative way for capturing system sounds in Windows (see below). That made me go back to Google manuals and guides. NB! DO NOT use this command! ffmpeg.exe -f gdigrab -i desktop -draw_mouse 1 -rtbufsize 100M -framerate 30 -probesize 10M -c:v libx264 -r 30 -preset ultrafast -tune zerolatency -crf 25 -pix_fmt yuv420p -f dshow -i -acodec aac -f flv rtmp://:1935/live/rtmp_streamīefore publishing the article on the blog, I tested it again and, to my dismay, saw that the stream was lacking both video and audio. And so, I decided to tidy up the code a bit - I put all the code for video capture and encoding first, put the code for audio capture and encoding second, and put the code for data transfer and stream formation last. While testing I caught myself thinking the FFmpeg screensharing command was rather chaotic. Following the manual I added the keys for screensharing into the stream going to a WCS server, successfully tested publishing via FFmpeg and playback via WebRTC on Windows and Linux and started writing this article. Eventually, I managed to find a combination of keys for FFmpeg that would allow to screenshare and capture audio. And for that reason, I spent a long time pouring through guides and googling solutions. Research for this article was my first experience with FFmpeg. A little tangent on the dangers of perfectionismĪt this point, I’d like to make a confession. Let’s take a look at two possible solutions using FFmpeg, one for Linux and one for Windows. The task is simple - we need to broadcast what’s happening on the screen to a site, where the stream will be played using WebRTC technology, and we need to capture both video and audio. We can sing it praises all day, but today we’re here for a different reason. All you need is a single file (ffplay.exe), that contains all the necessary codecs. You don’t need to search for a movie online, you don’t need to download and install codecs. There are many FFmpeg-based programs for file conversion. FFmpeg, however, retains its prominence thanks to its cross-platform support, minimalist interface (which is non-existent, since the control is executed through the OS console) and its vast functionality. It goes without saying that there are many streaming solutions out there, both paid and free. In this article, we’ll go a step further and we’ll see how to broadcast screensharing via FFmpeg and create a stream on your site. The Internet is full of guides on how to record what’s happening on the screen into a file using FFmpeg.
