Install ffmpeg on Linux – Easy!

Short Answer (quick read).

The question “how to install ffmpeg on Linux” can be answered as follows:

Actually the installation can be quite easy: if you have a good VPS plan that is managed by the provider you’ll get an easy 1-Click ffmpeg Install on Linux via the control panel.

If you don’t want a control panel for some reason you can scroll down to find complete instructions on the installation of ffmpeg on your own Linux server.

How to install ffmpeg on the Linux servers of this wonderful Cloud hosting company?

With the Managed Linux VPS of this Cloud provider you’ll get a cPanel control panel. You can easily install ffmpeg within cPanel at the click of a button. Under normal circumstances ffmpeg will be installed within a few minutes. But the installation of ffmpeg will probably be faster since the company is a Cloud Hosting provider. Moreover, this practically eliminates downtime.

See the VPS plans 

PS. By the way, I use this Cloud Hosting Service myself on a daily basis and I love it!

Hopefully this summary was good enough to explain how to install ffmpeg on Linux. However, we invite you to read on to learn everything about the details.

Long explanation.

Instructions for the installation of ffmpeg on Linux (Ubuntu).

Own live streaming server setup.

There is some documentation on this setup shown on Youtube. Often the instructions are incomplete or the necessary information is missing. After extensive research and reading into the topic, I made this setup. Many thanks to the open source community for doing an endless amount of preparatory work.

Requirements for the installation of ffmpeg on Linux Ubuntu:

  • VLC media player
  • OBS Open Broadcast Software
  • Zip unpacker
  • VPS Linux operating system used here: Ubuntu 18.03.

These instructions are to be carried out step by step. The following requirements are required for the installation.

  • Basic knowledge of the Ubuntu operating system
  • Using a simple text editor (HTML)

Before installing, you should bring your system up to date.

1. With the key combination [Ctrl] + [Alt] + [T] you open the console and enter the following command line. Enter your password and press [Enter]. Press [J] to perform the update.

$ sudo apt-get update && sudo apt-get dist-upgrade

2. The following necessary tools are to be installed next like this:

$ sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev

3. Download the nginx (pronounced “engine-X”) web server. It is currently one of the most powerful web servers.

$ wget

4. Download sources for the RTMP module

$ wget

5. Unzip and change to the server directory

$ tar -zxvf nginx-1.18.0.tar.gz
$ unzip
$ cd /nginx-1.18.0

6. Create and install the nginx server with the integrated RTMP module.

$ ./configure –with-http_ssl_module –add-module = .. / nginx-rtmp-module-dev
$ make
$ sudo make install

7. Create the necessary directory structure for the fragments of the video stream.

$ sudo mkdir / HLS
$ sudo mkdir / HLS / live
$ sudo mkdir / HLS / mobile
$ sudo mkdir / video_recordings
$ sudo chmod -R 777 / video_recordings

If Ubuntu VPS is operated with a firewall (default is off), the following rule must be inserted.

$ sudo ufw allow 80
$ sudo ufw allow 1935 sudo
$ ufw enable

8. The server is installed in the standard directory: / usr / local / nginx and will now be started. Open the browser and enter http: // <your ip address> / or “localhost”. The start page of the server appears. (The IP address of the server is output via the $ ifconfig command.)

Server start with:

$ sudo / usr / local / nginx / sbin / nginx

Stop the server with:

$ sudo / usr / local / nginx / sbin / nginx -s stop

9. Install FFmpeg to convert and package the stream.

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa: kirillshkrogalev / ffmpeg-next

10. Update and install the package list

$ sudo apt-get update
$ sudo apt-get install ffmpeg

11. Configure the server beforehand and save the original configuration file “nginx.conf”.

$ sudo cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.original
$ sudo nano /usr/local/nginx/conf/nginx.conf

12. Copy (overwrite) and save the entire content in the existing “nginx.conf” file.

Important: The placeholders “my-ip” have to be replaced with the IP address of your server. Example:

For “my-stream-key”, use your freely invented key e.g. tuy31nevyqz9.

worker_processes 1;
error_log logs / error.log debug;
events {
worker_connections 1024;
rtmp {
server {
lists 1935;
allow play all;

#creates our “live” full-resolution HLS videostream from our incoming encoder stream and tells where to put the HLS video manifest and video fragments.
application live {
allow play all;
live on;
record all;
record_path / video_recordings;
record_unique on;
hls on;
hls_nested on;
hls_path / HLS / live;
hls_fragment 10s;

#creates the downsampled or “trans-rated” mobile video stream as a 400kbps, 480×360 sized video
exec ffmpeg -i rtmp: // my-ip: 1935 / $ app / $ name -acodec copy -c: v libx264 -preset veryfast -profile: v baseline -vsync cfr -s 480×360 -b: v 400k maxrate 400k -bufsize 400k -threads 0 -r 30 -f flv rtmp: // my-ip: 1935 / mobile / $;

#creates our “mobile” lower-resolution HLS videostream from the ffmpeg-created stream and tells where to put the HLS video manifest and video fragments
application mobile {
allow play all;
live on;
hls on;
hls_nested on;
hls_path / HLS / mobile;
hls_fragment 10s;

#allows you to play your recordings of your live streams using a URL like “rtmp: // my-ip: 1935 / vod / filename.flv”
application vod {
play / video_recordings;

http {
include mime.types;
default_type application / octet-stream;

server {
listen 80;
server_name my-ip;

#creates the http-location for our full-resolution (desktop) HLS stream – “http: //my-ip/live/my-stream-key/index.m3u8”
location / live {
types {
application / m3u8;
alias / HLS / live;
add_header Cache-Control no-cache;

#creates the http-location for our mobile-device HLS stream – “http: //my-ip/mobile/my-stream-key/index.m3u8”
location / mobile {
types {
application / m3u8;
alias / HLS / mobile;
add_header Cache-Control no-cache;

#allows us to see how stats on viewers on our Nginx site using a URL like: “http: // my-ip / stats”
location / stats {

#allows us to host some webpages which can show our videos: “http: //my-ip/my-page.html”
location / {
root html;
index index.html index.htm;

13. Start the program OBS (Open Broadcast Studio) and leave the standard settings, except for the entry “URL” and “Stream Key”

Variable bit rate (not CBR or Constant Bit Rate), quality highest
Max bit rate-600kbps
Audio Codec AAC
Audio format-44.1khz
Audio bitrate -64kbps
URL “rtmp: // your-ip: 1935 / live”
Stream Key- “my-stream-key”
FPS (frames per second) -30
CFR (Constant Frame Rate) – Yes
Keyframe interval-2 seconds (one keyframe every 2 seconds)
x264 Encoding Profile-baseline (may work with main — depends on player used)
x264 CPU Present-veryfast

a) Select a video source in OBS, e.g. webcam
b) press the button “start streaming”

Result: The label on the button changes to “Stop streaming” and the transfer rate is displayed in the lower status line.

14. Now a test with the VLC media player follows. The menu item of the VLC, “Open media / network stream” and enter the following address:

Added: http: //my-ip/live/my-stream-key/index.m3u8

If everything went well, the VLC player shows your stream. Congratulations!

15. Embed stream in a website with the media player “Video.js”.

a) Download the video.js player and unzip it in the / usr / local / nginx / html directory.

b) Create the following HTML page with the name e.g. “my-index.html” in the above-mentioned directory.

<! DOCTYPE html>
<meta charset = utf-8 />
<title> Welcome to my streaming site! </title>
<link href = “/ video-js.css” rel = “stylesheet”>
<script src = “/ video.js”> </script>
<script src = “/ videojs-contrib-hls.js”> </script>
<script> var player = videojs (‘example-video’); ();


<video poster = “/ logo.png” id = “example-video” class = “video-js vjs-default-skin” controls preload = “auto” width = “640” height = “268” data-setup = ‘ {} ‘>

<source src = “http: //my-ip/live/my-streamkey/test.m3u8” type = “application / x-mpegURL”>
<p class = “vjs-no-js”> To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href=”” target=”_blank”> supports HTML5 video </a> </p>


16. Call up the created website in the browser:

http: //my-ip/my-index.html

The website appears with the inserted live player.

Further helpful pages for the setup I described:

How to install ffmpeg on Linux Ubuntu – a conclusion.

I sincerely hope that, using the instructions above, you managed to install ffmpeg on Linux. If, for whatever reason, it didn’t work out, don’t despair. In this case you still have several other options:

  • Request a managed VPS from Linux Hosts Inc. and they install it for you for free. See the beginning of this article.
  • Please refer to the comment section that follows below.
  • Send me an email and I will try to help you.

Good luck!


Comments: 74 thoughts on how to install ffmpeg on your VPS.

Bernfried Grosse-Venhaus
June 4, 2021 at 1:49 PM

Hello Richard!

I’m almost there, too: When the live feed starts, I can see the videos live with a more or less time delay with the corresponding URL on the PC, tablet and mobile phone in the browser. Happy !! The aim of my RTMP server is that authorized persons can watch the video of a fire brigade copter, which is also working on a test basis within my home network. RTMP transmission is available in the copter control software / app and also works. According to the Config, the videos are saved in the video_recordings directory. The FFmpeg videos are deleted after the RTMP live streaming.
Now I would like to make the content of the permanently stored videos available for selection on the same website and also offer it encoded using FFmpeg. As with the live stream.
If I understand the principle correctly, the stored videos in the video_ recordings directory on the website would have to be transferred to FFmpeg. Are there any ideas and code that I can use?

Thanks and Greetings

May 16, 2021 at 2:13 am

Hello Richard

That was a great guide. I worked with Linux for the first time and everything worked out great. A few things didn’t work out, but I checked with Google and it worked. So now to my problems. i can access the stream from the local network anywhere and stream it from any pc via obs to nginx, but i can’t come from outside (internet) on the server. So from my smartphone (mobile data) I cannot see the stream although I have cleared the port for nginx 1935 in my mikrotik router (TCP) I may have to enter the static ip in the conf file instead of the local ip or agree something the port forwarding not? However, I have to say that I have a shoutcast server running on another pc and have opened port 8000 and it works great there, why does it not work here, is it a setting point or because it is running on a virtual machine. I thank you in advance for your answer.

April 27, 2021 at 5:04 pm

Hello Richard!

Compliments on the instructions! I have two questions: Do the instructions also apply to the installation on a Raspi 4? I read your answer from June 9th, 2020, but maybe the 4 is potent enough? Do you need a license key for video processing? There was something about a Raspi video recorder project …How do I get it so that I can display and select the saved video files via web browser and play them in the browser? Thanks for hints!

Richard Detering
April 28, 2021 at 8:32 am

Dear Bernie,

For video processing, the more computing power, the better. There are no upper limits, “A lot helps a lot”! .-) Sure, that would be a great solution with the Raspberry Pi 4 B, but with 4x 1.5 GHz, 4 GB RAM, the single-board computer is not designed for a streaming server.

License keys are not needed on the live streaming server, you may mean the codecs. If they are not installed on the server, that should be done. Of course, it depends on the format or quality in which you want to make your stream available to your audience.

In the configuration file you can set whether your live stream should be recorded. In this case, the path or the URL of the cloud must also be specified. An archive is then created and this can be operated like a media library.

I wish you a lot of fun with the setup!

April 14, 2021 at 12:31 PM

Unfortunately I have the problem that in VLC the picture freezes every few seconds, then runs again for a few seconds what can be the reason?

Sven K
February 23, 2021 at 2:07 am

Hey, unfortunately my installation is unsuccessful. The “make” command cannot be executed. The following error occurs: make: *** No rule to make target ‘build’, needed by ‘default’. Stop. The whole thing should be installed on a KVM server with Ubuntu 18.04.5 LTS. At first I thought it was due to a faulty installation, but a 2nd and 3rd attempt also failed.
I hope someone can help me solve the problem. best regards

May 1, 2021 at 9:12 PM

The same error occurred with me. Is there a solution ?

January 21, 2021 at 8:03 PM

Nice instructions, but how do I get the video as an HTTPS URL?

Richard Detering
January 22, 2021 at 10:40 am

Dear Markus,

I am glad that you like the instructions. It’s a good idea to add SSL to the description. Switching to the https protocol is basically nothing different than on any website and I think there is enough information on this on the web. I just didn’t want to overload my setup instructions for my own live stream server.

January 19, 2021 at 7:23 am


I have a question, i would like to use this own server for a drone. Which rtmp path do I have to enter there so that it can stream? Thanks in advance

Richard Detering
January 19, 2021 at 7:45 AM

Hello Mr. Bersch,

Whether USB-Cam, ext. Webcam, studio camera or a “flying eye”, these instructions apply to all video devices.

January 13, 2021 at 10:50 PM

Good evening, I have successfully installed the server on a VServer. For me I had to deactivate the “Stats” in nginx.config. NGINX did not start with the following code. ” My correct IP is in the URL, I put “x” here in the post.

#allows us to see how stats on viewers on our Nginx site using a URL like: “”
#location / stats {

Does anyone have instructions for a Linux newbie on how to get the status query so that I can see how many users see my stream? Many greetings Mario

April 9, 2021 at 11:54 PM

Hello I hope I can help you. You have to add that to the ./configure “–with-http_stub_status_module” then that should work. The command should install the required plugin.
Best regards.

January 13, 2021 at 12:29 AM

Hello, thank you very much for the instructions. I still have 2 problems. Installation on Ubuntu 20.04.1 LTS.
What works:
1. Stream in VLC rtmp: //../live/key
2. Video recorder of the stream .flv
My problems
1. Stream in VLC rtmp: //../mobile/key
2. Stream in the video js player (error message: no video in supported format and MIME type found)
I am grateful for any hints. The stream video js is running on the same server. Can user rights for the HLS folders be an approach? Thanks!

Hans van Haga
January 10, 2021 at 11:07 PM

Hello !
Great guide, my question also works with Linux Mint cinnamon 20?

Richard Detering
January 11, 2021 at 8:27 am

Dear Hans, the core functions of Linux Mint 20 are the same as those of Ubuntu 20, so these instructions also apply to Linux Mint and everything should work as described.

January 8, 2021 at 1:37 PM

Hello everyone, have a question about nginx.conf

Delete the entire content of the original ngnix.conf and copy and edit the CODE from point 8?

Richard Detering
January 11, 2021 at 8:32 am

Yes, exactly Mario! The entire content of the “nginx.conf” file created with the installation is deleted and overwritten with the content described here. The intended placeholders must of course be replaced afterwards.

Mario Brandt
January 8, 2021 at 12:07 AM

Who can tell me on which vSERVER the Nginx was successfully installed without problems. I would be interested in the provider and the Ubuntu version. I currently have Ubuntu 16.04 LTS, a new version or as in the instructions 18.03 is not available there.

January 6, 2021 at 12:51 AM

You write one should replace “my-streaming-key” everywhere, but in the config you never used “my-streaming-key”, except in the comments. Do I only have to use it in OBS and in the URI itself and Nginx know what to do? Or did I miss something?

Richard Detering
January 6, 2021 at 9:15 am

Hello, thank you for the question! In fact, the placeholder “my-streaming-key” refers to the relevant entry in the field of the OBS application for the streaming key. I’ve just improved this little flaw in the setup instructions.

Sven Rönnfranz
December 23, 2020 at 5:49 pm

Hello Richard,

I had a few problems at the beginning, had to reset the VPS several times, but everything worked out fine in the end.
However, I have a question: I would like to integrate the WebPlayer (html-code) on a different homepage than my streaming server. Simply packing the video script into a folder on the other home page and linking the link to the streaming server did not quite work. Error: “The media could not be loaded, either because the server or network failed or because the format is not supported.” Nevertheless, I know that the file works, because everything runs wonderfully via the link http: //my-ip/livestream.html. Now my question: how do I forward the streaming link to another homepage.

Regards Rönne / Sven
P.s .: still very great instructions!

Richard Detering
December 23, 2020 at 5:59 pm

Hi Sven,
That shouldn’t be a problem, please check the links again. Are the ports on the firewall of the external server on which you are installing the player activated?

Sven Rönnfranz
December 27, 2020 at 2:24 pm

Hello Richard,
So I checked again and the port 1935 should be activated.
But I wrote to my website provider again, because the external homepage was rented as web space and does not run on a VPS or the like. The links are all entered correctly. Hope you had great holidays.

Regards Sven

April 9, 2021 at 9:06 PM

Hello, I have the same problem. The Video.js goes there everything is loaded. The link also works, if I copy this and paste 1 & 1 into vlc I can see the stream. I completely deactivated the firewall as a test so that all ports are open. Nevertheless, the message “The media could not be loaded, either because the server or network failed or because the format is not supported” appears on the external server. Can someone help me?

April 9, 2021 at 10:18 PM

I found the solution.
1. Must be set up https
2. The line “add_header, Access-Control-Allow-Origin‘, * ‘;” must be specified under location / in nginx.conf, otherwise video.js cannot access it. I had problems with Certbot and simply used a different config file to work around this and then added the paths to the certificate. I hope I could help.
Best regards, Jonathan.

December 7, 2020 at 2:02 pm

Good day,

Thank you very much for these detailed and really good instructions. I would like to set up an RMTP server on the Internet in order to stream a stream from the mobile phone over the Internet to a website with an integrated HTML5 player. What do I have to consider when choosing a server (provider)? Is a normal Linux server that can be rented enough, or do I have to pay more attention to RTMP?

Richard Detering
December 8, 2020 at 7:24 am

Hi Andreas,
A rented Linux VPS server meets most standard requirements for live streaming. Of course, special requirements depend directly on your project and the quantity structure. The solution described here, with the fastest web server currently on the market, can already cover a lot and offers you good performance. I would choose an approach that is easily expandable. A detailed documentation of your project is helpful for the operation, maintenance and care.

Have fun and good luck with your project!

November 22, 2020 at 8:55 pm

(1) Which protocol (TCP / UDP / ESP / GRE) do I have to select in the Fritzbox share, and which port internally (1935?)? (Example: “(MyDynDns): 1234 -> Enable Fritzbox forwards ->”)

(2) How does the link for an external VLC look like: “rtmp: // (MyDynDns): (MyFritzboxReleasePort) / live /”?

Christoph Hammann
October 19, 2020 at 11:49 am

How do I certify the server for HTTPS? The self-created SSL certificate is not sufficient for my app. The stream is running. Thanks. But the link as https: //XY.m3u8.

October 25, 2020 at 6:06 pm

Have a look here: This page helped me a lot …

October 4, 2020 at 10:29 am

First of all, thank you very much for these instructions and for the work and your time that went into it. Except for one thing, everything worked great. Unfortunately, I could not install ffmpeg from the PPA repository, because apparently there is no corresponding package for Ubuntu 18.04. So I installed ffmpeg from the standard sources. That works too. When everything was running I tested the same thing again, without any problems, with an Ubuntu 20.04 as a base. If someone finds it useful, I’ve made a Docker image out of it:

FROM Ubuntu: 04/20
RUN apt-get update && \
apt-get dist-upgrade && \
export DEBIAN_FRONTEND = noninteractive && \
apt-get install build-essential libpcre3 libpcre3-dev libssl-dev wget unzip software-properties-common ffmpeg tzdata -y && \
ln -fs / usr / share / zoneinfo / Europe / Berlin / etc / localtime && \
dpkg-reconfigure –frontend noninteractive tzdata && \
wget && \
wget && \
tar -zxvf nginx-1.18.0.tar.gz && \
unzip && \
cd /nginx-1.18.0 && \
./configure –without-http_gzip_module –with-http_stub_status_module –with-http_ssl_module –add-module = .. / nginx-rtmp-module-dev && \
make && \
make install && \
mkdir / HLS && \
mkdir / HLS / live && \
mkdir / HLS / mobile && \
mkdir / video_recordings && \
chmod -R 777 / video_recordings
COPY nginx.conf /usr/local/nginx/conf/nginx.conf
CMD / usr / local / nginx / sbin / nginx -g ‘daemon off; ‘

October 4, 2020 at 2:49 pm

Thank you, Nino! I’ll try that right now …

December 29, 2020 at 13:57

First of all, thank you very much for these instructions, as a Ubuntu 20.xx newbie I still have one or the other question.
Quote: If someone finds it useful, I made a Docker image out of it Is that an install script, so to speak? , that means I create a new file, copy everything in, name it e.g.
Execution would then be ./install.nginx

Richard Detering
December 29, 2020 at 5:03 pm

Hi Eddi,
Thanks for the appreciation! Getting started with Ubuntu is definitely worth it. If Windows is no longer running on your computer, Ubuntu works like a turbo. What I want to say, deal with the elementary step-by-step instructions first. I have not tested the very good contributions to the further development of an installation script. Just ask the author, he will surely help you quickly. Good luck with testing!

Steffen Balzert
September 25, 2020 at 12:12 pm

Unfortunately, the server-side installation fails for me (on a Strato VServer with Ubuntu 20.04) on make. I get the error message “No rule to make target ‘build”, needed by “default”. Stop.” Do you have any ideas?
Best regards

Sharp Sharpened
September 3, 2020 at 3:19 pm

Another addendum: I have now got everything up and running, with a few adjustments. There were also a few error messages with repository. It worked in the end, but the bug remains.

I use Unbuntu 20.04.1 LTS (focal)

1. Needed an additional package (libghc-zlib-dev), so
$ sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev libghc-zlib-dev

2. Had to change the option “HTTP_STUB_STATUS = NO” to “HTTP_STUB_STATUS = YES” in the / auto / options (in the unpacked nginx directory).

3. $ sudo add-apt-repository ppa: kirillshkrogalev / ffmpeg-next outputs the following:
“This PPA provides backported release ffmpeg for current releases Ubuntu (Trusty, Utopic, etc.)
More information:
Press [ENTER] to continue or Ctrl-c to cancel adding.

Ign: 1 focal InRelease
Get: 2 focal-security InRelease [107 kB]
Miss: 3 focal release
404 Not Found [IP: 80]
OK: 4 focal InRelease
OK: 5 focal-updates InRelease
OK: 6 focal-backports InRelease
Package lists are read … Done
E: The depot “ focal Release” does not contain a release file.
N: Updating from such a depot cannot be done in a safe way, so it is disabled by default.
N: Further details on the creation of package repositories and their user configuration can be found in the manual page apt-secure (8). ”

4. It would be nice if I could run all the stuff with “systemctl enable nginx” so that everything comes up again after a restart. I don’t have the experience how to adapt it so that it works.

Otherwise everything works great. Thanks again for the instructions!

Sharp Sharpened
September 3, 2020 at 12:23 pm

First of all, thank you very much for these instructions.

I still needed the libghc-zlib-dev package for the ./configure command, because it complained with the following error message:

“./Configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using -without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using -with-zlib = option. ”

I’m still in the whole installation process and am just wondering where all the directories that are supposed to be created should go. In fact in “/”?

April 14, 2021 at 12:28 PM

Do “sudo apt install zlib1g-dev”, that should fix your problem. Then again the ./configure command 😉

August 14, 2020 at 10:29 am


I need an RTMP signal in and an HTTPS:… / xy.m3u8 signal / file so that I don’t get an error message in the browser of users of my APP that the connection is insecure.

How do I do that?

August 14, 2020 at 12:12 pm

Thank you for your question! How is your specific system structure? It is not a big challenge to establish a secure connection to the live stream server. There are many simple and free solutions. I would just build my own VPN and create a certificate myself. Then you have an https connection and the stream from your live streaming server is safe. The browser no longer throws a notification message, the user is no longer afraid. This means that there are no additional costs, such as when you conclude a contract with a VPN service provider. Another advantage is that your users can receive your live stream worldwide, as this also eliminates the problem with geoblocking.

August 6, 2020 at 6:46 pm

Hello Richard,
I had already played around with nginx.
I’m a little confused, will the .conf also save the stream?
record all + record_unique on indicates for me …

If I recognize it correctly, the incoming rtmp stream is converted and then sent out. What’s the latency like there?

Greetings Thomas

August 6, 2020 at 7:16 pm

Hello Richard again,

Does the manual also work with the current version 1.18?

Greetings Thomas

August 7, 2020 at 5:31 am

Thanks Thomas for the question. For the setup described here, I recommend that you use the current version of the nginx. Higher versions have been bug fixed and further developments. Simply replace all information about the version that I used in the instructions with the current version of the nginx web server. Of course, the live stream server also runs with the current version. I could actually adapt it so that the instructions remain up-to-date. I wish you a lot of fun and success with the construction!

August 7, 2020 at 5:15 am

Hi Thomas,
Basically, the stream is just a number of many individual images that are shown one after the other at high speed, like in a flip book. The pictures learn to walk :-). Every single image is cached and converted. For some use cases it makes sense to save the stream, e.g. to offer it to customers later as a can. E.g. to offer the live recording later in a separate media library. These settings can be configured in the .conf. Thomas, as you write, the rtmp stream is converted and then “sent”. With the currently fastest web server of the nginx, you create the best performance. Of course, all other components are relevant for the user experience. I couldn’t find any noteworthy latencies on my live stream server. Of course, the live stream arrives at the consumer with a time lag in relation to real time, but this time lag remains stable. But we also have this behavior with every live broadcast on TV or radio.
What is the specific goal of your question? In my opinion, latencies are only critical in a bidirectional transmission and then have a detrimental effect on the user experience. The live stream server described here can be seen as a broadcaster.

August 7, 2020 at 5:46 am

Hello Richard,
I am an amateur radio operator and am the system operator of an amateur radio television relay. All an ambitious hobby
We stream the radio broadcast on our website in order to give those who are interested outside of the radio range the opportunity to take a look at us.
There is also a bidirectional exchange, where long latencies (> 5 seconds) interfere.
Hence my question.

If I see it correctly, is the transmitted stream no longer an RTMP and therefore not affected by the EOL in November?

I’ll experiment a little then.

We made our pages with WordPress and then a page needs to be set up accordingly.

Greetings Thomas

Lars Franke
July 29, 2020 at 4:02 pm

Hello Richard,
I would like to know how good your experience has been with HEVC and NGINX. Is it even possible to transcode an incoming H256 and output it in other forms than H256?

July 13, 2020 at 2:04 pm

Thanks for the instructions, great!
Since I have a small Milestone Server on the other end for the viewers, would it be nice to somehow transcode the stream to access it? (Onvif or universal driver?)
I don’t know the rtmp module very well yet … could something be possible there?
Thanks & greetings Martin

Richard Detering
July 16, 2020 at 3:59 pm

Thank you TINO for your question and suggestion. I haven’t dealt with it more intensively, but I am happy to ask this question to the readers of this article. Maybe someone has a link for you?

July 12, 2020 at 10:33 pm

Isn’t it a potential security risk to keep the stream key in the player HTML?

Richard Detering
July 16, 2020 at 3:53 pm

It wasn’t necessary for my solution described here. The implementation of further security requirements depends directly on the use cases and of course on all details of the system architecture.

July 2, 2020 at 18:12

Actually everything is going as described, please ask how do I get the stream integrated into an existing website? I have made several attempts, the message hls Video File not found… appears.
Everything works with VLC Player.

July 3, 2020 at 6:10 am

Hello Heiko,

So you are almost there, great! In order to be able to answer your question, I would need more circumstantial evidence. What is your specific setup (network configuration, router, CMS, firewall, etc.)? How / who hosts the website on which web server, if applicable? What code did you use to embed the live stream on the website? Are the necessary ports of the firewall open, if applicable? What are the settings for dynamic DNS? Can your live server server be reached over the internet? What’s the url?

Sorry Heiko for all the questions, but you can’t do without them. 🙂 Maybe my questions will help you to find the right configuration yourself.

Best wishes

July 3, 2020 at 16:47

Thanks for your answer !
I have made progress in the meantime, which means that I was able to integrate the stream on my website and it also runs, unfortunately very “jerky”. I think that first of all a lot of questions are answered like firewall, ports etc., because if that is not “free” or open or configured incorrectly, then it would not work “jerky”.
The whole thing is currently a pure “test / experiment” project. I use the provider for my homepage to test “server professionals”. The Stream Server is in a different place, with a 100,000 DSL connection. It is sent “locally” via OBS to the StreamServer and I have integrated FlowPlayer into / on my homepage as a test. But it doesn’t work smoothly….
If you have the time and inclination for tests etc. I could send you all the data, but not here in public. I would be very happy to receive help and advice, streaming is new territory for me, but I’m capable of learning
Thanks Heiko

June 16, 2020 at 11:38 am

Yes, I wanted to access the alternative with obs first, but opengl 3.2-capable hardware is required for this, the server only provides opengl 3.0 because it is only one vps. For this reason I wanted to use nginx and the associated modules.

October 25, 2020 at 8:12 am

Hi @Jerome
If you have been successful with your project, I am looking for a way to stream 24/7. With my VPS provider I don’t have a GUI, unfortunately only command line (I don’t think I’m a pro when it comes to Linux either) and I want to stream on different platforms at the same time.

I can’t get on by myself like this!

June 15, 2020 at 5:18 pm

Hello Richard,

Am quite new to nginx and rptm! Is it possible to stream videos in mp4 format on the server using nginx (rtpm, hls, ffmpg) to twitch! Would like to set up a 24 hour stream where the mp4 videos that are on the server are played back one after the other. Since it is a VPS server, no obs can be used.
Thank you for your help!

Richard Detering
June 16, 2020 at 4:08 am

Hi Jerome,

What is stopping you from installing OBS on a VPS server? There are tutorials on the internet, so no problem. Of course I would recommend a VPS with Ubuntu Linux. In order to achieve an even greater range of your “transmitter”, you could also broadcast your videos simultaneously and 24/7 on other streaming servers (Facebook, Youtube, Periscope, Vimeo, etc.). I wish you every success with your project.

June 5, 2020 at 1:20 pm

Hello, would that also work with a Raspberry Pi?

Richard Detering
June 9, 2020 at 12:49 pm

Hi Florian,
Installing a web server on the PI is a great idea and works great. This is ideal for many applications, as the PI works silently and consumes hardly any electricity. The small Pi is completely overwhelmed for a streaming server. Its strengths lie in other areas.

June 5, 2020 at 12:40 pm

I set up a current server (Ubuntu20.04 / nginx1.19 + rtmp module) and got it to work with these instructions. Thanks for that.
Only the mobile stream didn’t want to. The solution was a typing error in the exec ffmpeg command.
I replaced maxrate with -maxrate and / $ at the end with / $ name. Then it worked.

Richard Detering
June 9, 2020 at 12:53 pm

Hello julian,
Great, thanks for your feedback, we make a living from it 🙂 I’ll take a look at the instructions in this regard right away, it may be a typo. In any case, your hint is already helpful for the community. Thx

February 3, 2021 at 3:57 am

Many thanks for your response.
I looked for the error for a long time and your comment helped me to solve the problem 🙂

Harry Schmidt
May 23, 2020 at 10:55 am

First I had 7.6.5 and then went to the latest 7.8.1, but it hasn’t changed. videojs-contrib-hls is version 5.15.0

I’ll try again then.

Harry Schmidt
May 23, 2020 at 9:19 am

Hello Richard.
First of all, thank you for your efforts!
I followed your instructions (old nginx uninstalled beforehand). With me (Ubuntu Server 18.04.4) I had to install libnginx-mod-rtmp afterwards. It works so far until the test with the vlc. Then I come to Video.js and get the message “The media could not be loaded, either because the server or network failed or because the format is not supported”. The window stays dark.

I couldn’t find the JS module videojs-contrib-hls.js and got it from here: hls.js but no change.

Several of these lines can be found in the error.log:
2020/05/23 09:12:40 [debug] 27879 # 0: * 1 hls: update fragment
and in access.log like this: [23 / May / 2020: 09: 15: 27 +0000] PLAY “live” “123” “” – 413 89167 “” “LNX 9,0,124,2” (1s)

May 23, 2020 at 9:48 am

Hello Harry, please have a look which JS module I used at the time. It sounds to me like it’s an incompatible version. You should actually be able to continue building the required configuration with the system messages. It is well known that every Linux distribution has a different range of functions, so it is also common and often required modules / libraries to be installed. The Linux system messages are often very helpful and indicate missing components. Wish you continued success.

Harry Schmidt
May 23, 2020 at 10:51 am

Correction: I didn’t need to install libnginx-mod-rtmp. However, with ./configure I also have to specify –with-http_stub_status_module.

In the debugger (FF and Chrome) I get the JS message:
TypeError: The element or ID supplied is not valid. (videojs)

But I suspect that it is the mime type? There was also a message in the console that application / x-mpegURL does not support. This is also not in the configuration of nginx. Other types, for example video / mp4, do not work either.

May 19, 2020 at 4:21 pm

Hello, the setup description was also very helpful for me as a Linux novice. Stream runs smoothly on all devices (including smartphones). Thanks for the cool description. Now it would be good to know how I can access it from “outside” my home network. So far I haven’t managed to do that. I use a V-DSL DS-lite connection and am therefore dependent on third-party providers for IPv6 routing. The Fritzbox – Myfritz – port release has so far not brought any success.

Richard Detering
May 19, 2020 at 4:41 pm

Hi Falk,
Congratulations! Thanks for your feedback and as a Linux newbie – hats off! You did quite a bit of concentrated work there.
I am happy to help you with access from the outside. I tested two third-party providers and am surprised by the extremely stable paid service from Linux Hosts Inc. The dynamic DNS service is set up quickly. To do this, you have to enable the relevant ports on your router, both TSP and UDP ports and under the “Dynamic DNS” settings, enter the access data. If everything works out, the whole world can have your video stream on your own server. I wish you success!

May 19, 2020 at 5:20 pm

Hey Richard, thanks for your quick reply. My problem is that a Dynamic DNS provider probably didn’t help me. I tried a few until I found out that my internet access was via a DS-lite tunnel. I can get around that by sending the DynDNS (dynamic DNS) from MyFritz! Use sharing. Now it would be interesting to know which ports I have to release for it. So also UDP…. I think we’re getting closer to the matter 🙂

Richard Detering
May 20, 2020 at 5:06 am

Exactly, in the Fritzbox you enter the DynDNS access data from your provider and enable ports 80 and 443. You will then drill two holes in your firewall 🙂 Background: You will receive a fixed URL from your DynDNS provider, e.g. and a user name and password, so that your live streaming server is always accessible via the Internet even if your Internet service provider (ISP) changes your public IP address every 2 days for security reasons. I have already built the setup with a Raspberry Cam and it monitors our property: Raspberry PI2 with Motioneyeos

May 14, 2020 at 9:34 am

Hello, I successfully set up a stream with it, it works very well. The video quality is very good and it’s fluid too.

Richard Detering
May 15, 2020 at 12:11 pm

Thank you for your feedback, I am pleased that this post was helpful to you.