Archive for the ‘Sysadmin’ Category

OBS and Nginx for streaming @ home

Saturday, June 27th, 2015
This article is a compact version of the tutorial from the OBS forum for those who want a local streaming server at home.
You can download Open Broadcaster Software here.

EDIT: After a few misfortunes with jwplayer (constant breaks), I switched to the promising videojs. Post updated accordingly.

First, you’ll need a few libraries, which you can install with [insert favorite Linux package management software]:

libssl-dev
pibpcre++-dev

Then, Nginx needs to be recompiled with a RTMP module maintained by arut:

wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar xf nginx-1.8.0.tar.gz
cd nginx-1.8.0
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
unzip master.zip
./configure --with-http_ssl_module --add-module=./nginx-rtmp-module-master
make
sudo make install

Nginx configuration : /usr/local/nginx/conf/nginx.conf
In the ‘server’ section:

listen 8000; # Or whatever port suits you

Then add a new rtmp section at the end:
  1. rtmp {
  2.         server {
  3.                 listen 1935;
  4.                 chunk_size 4096;
  5.  
  6.                 application live { # Application name, could have been pony or menakedinmaroomlol
  7.                         live on;
  8.                         record off;
  9.                 }
  10.         }
  11. }

Then launch the server:
usr/local/nginx/sbin/nginx

Then, you’ll need a Web player to stream the content. I chose videojs, but any player should do the trick. You’ll of course need a web server to host it somewhere. Apache is fine. SimpleHTTPServer is fine too.

First, get videojs on their website (or on Github if you’d like a self-hosted player)
Then:

unzip video-js-5.10.4.zip
cp -R videojs-5.10.4 /var/www/ # or whatever folder suits you

And create the web page that will host the player:
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5. <link href=“videojs/video-js.min.css” rel=“stylesheet”>
  6. <script src=“videojs/video.min.js”></script>
  7. <script>
  8.   videojs.options.flash.swf = “videojs/video-js.swf”
  9.   </script>
  10. <video id=“example_video_1” class=“video-js vjs-default-skin vjs-big-play-centered”
  11.        controls preload=“auto” width=“640” height=“360”
  12.        poster=“pony.jpg”
  13.        data-setup=‘{“example_option”:true}’>
  14.   <source src=“rtmp://192.X.X.X/live/test” type=“rtmp/mp4” />
  15.   <p class=“vjs-no-js”>To view this video please enable JavaScript, and consider upgrading to a web browser that <a href=“http://videojs.com/html5-video-support/” target=“_blank”>supports HTML5 video</a></p>
  16.   </video>
  17. </body>
  18. </html>

 

Finally, you’ll just need to configure OBS to stream to your newly deployed nginx:

Streaming Service : Custom
Server : rtmp://192.X.X.X/live
Play Path/Stream Key : test

Profit !

Automatic Pogdesign/EZTV synchronizer

Tuesday, February 15th, 2011

You’re maybe familiar with Pogdesign, a british website offering a free TV Shows online calendar; when registering, you can add filters for the TV Shows you follow, and access to the corresponding Ical file.

Like utorrent RSS synchronizer, I wanted to automatically look for the release of my favorite shows using rtorrent. I’m pretty sure there are plenty of tools around the web to do it, but I preferred to do it myself.

Here is a little script that:

  • Checks in your PogDesign calendar if new shows are airing today
  • Updates your shows database according to your calendar
  • Checks on EZTV RSS Feed if any of your show is available for download
  • Puts the appropriate .torrent files in the location you want

You’ll need sqlite3, perl5, DBI::SQLite and XML::RSS::Parser::Lite (just run perl -MCPAN -e ‘install XML::RSS::Parser::Lite’).

Just open the script and adjust the top-variables according to your needs (url of the calendar, path to store the torrents, RSS Feed). Run the script with -v to get verbose output (useful for logging when put in a crontab every day 🙂 ), run it with -t to get the list of the RSS torrents, and with -s to see your waiting shows.

The code is ugly, and regexes need improvement. I plan to do an automatic subtitles synchronyzer later.

Cheers,

DOWNLOAD