Sat 14 Oct 2006
Flash Video (FLV) Streaming With Nginx
Posted by Scoundrel under Uncategorized ·
I was looking forward for this feature for last 3 months! And at last, it is there! Now, nginx works on our streaming servers perfectly and flv streaming will not be Lighttpd’s unique feature anymore.
This post is about how to use new Nginx module http_flv_module introduced in 0.4.7 (but there was a bug in its implementation, that can be fixed with my patch) and made completely perfect in 0.4.8.
First of all, to use new module, you should (re)complile nginx with –with-http_flv_module option:
# ./configure --with-http_flv_module ...SOME-OTHER-OPTS...
Next your action should be activation of flv streaming module for your flv files in nginx.conf:
http {
...
server {
...
location ~ \.flv$ {
flv;
}
...
}
...
}
This option will instruct nginx to add special “header” information to data stream if user asked for some flv file and passed parameter “?start=XXX”, which means “give me that flv file from byte XXX to the end of file” (this is the idea of flv streaming).
Last your action, if it was not done before, should be conversion of your video files to FLV format and adding meta info to your created flv files. You can read how to do it in my previous post.
As always, I want to ask you, if you like this post, support it on Digg.com
- Using Lighttpd, Mplayer/Mencoder and Flvtool2 to Implement Flash Video Streaming
- Russian Feed Has Been Fixed
- Google Educational Seminars (techtalks) and Saving Google Video to Local Disk
- 1000 Great Technical Videos in BestTechVideos Library!
- Compiling nginx in RedHat Linux: PCRE library problem
2006-10-14 at 11.21 pm
[…] Notice: Read my new article about flash streaming “Flash Video (FLV) Streaming with Nginx” to learn, how to implement streaming server with nginx. […]
2006-10-17 at 6.01 am
Hi there
when can we get aio enabled on nginx?
thanks
2006-11-06 at 1.01 am
Сделал все, как сказано в статье, но nginx выдает ошибку 404. В чем может быть проблема?
nginx/0.4.12
2006-11-06 at 2.02 am
Самый простой метод - поглядеть в error_log - там точно сказано
2006-11-06 at 9.55 am
Разобрался, спасибо.
2007-01-21 at 7.00 am
Impressive article. But I could not make nginx work with php, ruby etc in my debian 3.1 VPS with debian etch as HN with OpenVZ.
I followed a tutorial at http://concentrationstudios.com/2006/8/26/nginx-and-rimuhosting-a-grand-ol-time but it does not behave like it is stated after executing the php-spin script in the article.
Debian certainly has nginx binary package in their repositories but I am not sure whether they support all the nginx modules and scripting languages.
Here I have noticed wonderful experts in nginx and lighttpd. I wish experts here (particularly Scondrel) could advise me how to proceed?
Thank you! Spaciva bolshoi!
2007-02-12 at 8.31 pm
А как реализовать flv-стриминг в nginx вместе с его внутренним редиректом (X-Accel-Redirect)? $request_uri после редиректа уже не содержит первоначального параметра start..
2007-02-12 at 8.33 pm
2lhotski: А что мешает передавать этот параметр в редиректе? Скрипт получает его через GET и отдает назад в редиректе вместе с именем файла.
2007-02-12 at 9.06 pm
2Scoundrel: Насколько я понял, параметр для X-Accel-Redirect не парсится как URI, а воспринимается как путь к файлу, который приаттачивается еще к пути в root внутри location. и при отсутсвии файла “/path/some.flv?start=XXX” естественно выдает 404.
Может URI можно как то дополнительным заголовком сформировать? или я жестко туплю?
2007-02-12 at 9.14 pm
2Scoundrel: о, пардон, нашел
2007-03-29 at 11.51 am
[…] Последнее действие, которое требуется, если вы его еще не сделали, - это конвертация Вашего видео в FLV формат и добавление meta-информации в созданные файлы Стриминг Flash Video при помощи Nginx […]
2007-04-25 at 3.11 pm
Is there any way to secure the streams so that users cannot download the flv directly?
2007-07-11 at 12.35 pm
немогу сообразить обязательно указывать file.flv?&start=123
а если без этой переменной то должно отдать файл с 0 байта, правильно я понимаю?
2007-07-28 at 2.17 pm
Hi,
how is the performance of nginx? can it support thousands of users at the sametime?
thanks
2007-08-01 at 12.22 am
Itam,
Nginx is famous for it’s blazing performance.
2007-09-10 at 1.04 pm
Hello,
how can I do live streaming video with Nginx ? It is possible ?
2007-11-15 at 8.04 pm
нашёл небольшой баг в nginx, если flv-директива стоит после защиты от хотлинка, то стриминг нихрена не работает - отдаёт весь файл целиком, если же до хотлинка - то работает.
вот пример правильной конфигурации:
location ~ \.flv$ {
flv;
}
location ~ \.(jpg|jpeg|gif|mpg|mpeg|wmv|avi|flv)$ {
access_log off;
valid_referers none blocked server_names *.site.com/;
if ($invalid_referer) {
return 403;
}
}
2008-04-28 at 9.36 am
YouTubeRobot.com today announces YouTube Robot 2.0, a tool that enables you to download video from YouTube.com onto your PC, convert it to various formats to watch it when you are on the road on mobile devices like mobile phone, iPod, iPhone, Pocket PC, PSP, or Zune