Recompile nginx to allow proper mp4 video streaming

1,917 views
Skip to first unread message

Marceau C.

unread,
Jul 10, 2014, 5:06:40 AM7/10/14
to opene...@googlegroups.com
Hi,

I want to host my mp4 vidéos directly as static files within the Files & Uploads of a specific course.

With the default edX configuration, I cannot fetch the video at a specific time and I do not get video duration. This is quite annoying.
After some search, I saw that nginx has a mp4 streaming module : ngx_http_mp4_module ( http://nginx.org/en/docs/http/ngx_http_mp4_module.html ).

To add the module, I need to recompile nginx, or install a recent version (it seems that it is a default module now).

1) Why does the nginx version is an old one ? Mine is nginx/1.1.19, while the stable version is 1.6 currently. Can I install a recent version, or is it necessary to have the 1.1.19 ?
2) Is it easy to do the configuration of nginx for OpenEdX ?

Thanks !

Marceau C.

Trinh Nguyen

unread,
Jul 10, 2014, 5:29:24 AM7/10/14
to opene...@googlegroups.com
Hi Marceau,

As far as I know,

1. Nginx 1.1.19 is the latest version in Ubuntu 12.04's repo (installed using apt-get). If you want to get the newer version of nginx using Ubuntu's package manager you have to setup and maintain the repo yourself, then add your repo to the sources.list.

2. Yes, your OpenEdX is just a Ubuntu server (I assume that you're running a Ubuntu server).

You're right, the only way to add the mp4 module is to compile nginx from source. So, first uninstall nginx, compile the latest nginx, and install again. Make sure your nginx.conf include the /edx/app/nginx/sites-enabled/* and /edx/app/nginx/conf.d/*.conf directory.


Hope that will help,

Trinh


--
You received this message because you are subscribed to the Google Groups "Open edX operations" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openedx-ops...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marceau C.

unread,
Jul 11, 2014, 10:23:04 AM7/11/14
to opene...@googlegroups.com
I did it, and it was really easy as the config file remained after I uninstalled nginx.
So after the reinstalation is was instantly ok.
The issue is ... it seems it didn't help.

After a long search, I understood that Files & Uploads documents are stored within the Mongo database, not as pure files.
I put a .mp4 file in the pure static files, and it runs without any issue ... I don't even have to add the mp4 instructions inside the nginx files.

So :
1) I don't know if updating nginx was useful or not.
2) Pure static .mp4 files work fine.
3) Files & Uploads .mp4 files do not work fine, it may come from the fact that they are hosted in MongoDB and served through a python query and that query is not made to serve specific chunks of the file on demand.

My issue is that I want easy upload of video for users (the Files & Uploads is perfect), uploading .mp4 files in another server would be more complex.

I'll see if I can do something else.
Thanks anyway!

Marceau C.


For those who could be interested :
sudo apt-get remove nginx
sudo apt-get install build-essential zlib1g-dev libpcre3-dev libssl-dev libxslt1-dev libxml2-dev libgd2-xpm-dev libgeoip-dev libgoogle-perftools-dev libperl-dev
wget http://nginx.org/download/nginx-1.6.0.tar.gz
tar xvfvz nginx-1.6.0.tar.gz
cd nginx-1.6.0
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-google_perftools_module --with-debug
make
sudo make install
Reply all
Reply to author
Forward
0 new messages