{"id":1544,"date":"2013-07-04T11:04:17","date_gmt":"2013-07-04T09:04:17","guid":{"rendered":"http:\/\/www.alkannoide.com\/?p=1544"},"modified":"2015-10-26T14:35:13","modified_gmt":"2015-10-26T13:35:13","slug":"play-with-ffserver-a-quick-overview","status":"publish","type":"post","link":"https:\/\/www.alkannoide.com\/2013\/07\/04\/play-with-ffserver-a-quick-overview\/","title":{"rendered":"Play with ffserver – a quick overview"},"content":{"rendered":"

\"ffmpeg\"<\/a>Everybody knows ffmpeg<\/a> the command line encoding tool but do you know ffserver ? ffserver<\/a>\u00a0is a multimedia streaming server for live broadcasts. With it, you can stream over HTTP, RTP<\/a> and RSTP<\/a>.<\/p>\n

Quick overview<\/h2>\n

The concept is to use ffmpeg to push content to one server. This server will transcode streams and deliver to the end-users.<\/p>\n

\"FFServer<\/a><\/p>\n

Input streams are called feed and for each feed you can have multiple output stream.<\/p>\n

We can manage ffserver via a configuration file. The syntax is close to the one used for Apache server. You can find a example here<\/a>. And there are more informations in the ffserver wiki<\/a>.<\/p>\n

We will see two examples on how to deliver content via a ffserver. There will be a FLV and a WebM stream.
\n<\/p>\n

Stream FLV<\/h2>\n

In this example, we will have one input stream and two output : one in FLV and one WebM.<\/p>\n

Here are the general configuration settings<\/p>\n

\r\nPort 8090\r\nBindAddress 0.0.0.0\r\nMaxHTTPConnections 2000\r\nMaxClients 1000\r\nMaxBandwidth 1000\r\nCustomLog -\r\n<\/pre>\n

We define a status page.<\/p>\n

\r\n<Stream stat.html>\r\nFormat status\r\nACL allow localhost\r\nACL allow 192.168.0.0 192.168.255.255\r\n<\/Stream>\r\n<\/pre>\n

This page will help us to monitor the server. This page is call with this url : http:\/\/localhost:8090\/stat.html and you will get this page :<\/p>\n

\"ffserver-status\"<\/a><\/p>\n

Now we set up the feed : storage area, max size and allowed referrers. Remember, feeds are the input of the ffserver.<\/p>\n

\r\n<Feed feed1.ffm>\r\nFile \/tmp\/feed1.ffm\r\nFileMaxSize 1G\r\nACL allow 127.0.0.1\r\n<\/Feed>\r\n<\/pre>\n

Ok, our configuration file have now a input feed. Now, we will add the first output : the FLV one. The video will be encoded in H264 for video and AAC for audio. This part is divided in 3 part :<\/p>\n