13 January 2011

nginx - MP4 streaming

One of the things that i love about nginx, except the fact that it's super fast, is that you can find documentation about anything you would like to do with it over the internet... and the documentation is good!

For example, i wanted to install a module, that will allow me to stream MP4 files (from pictures4.net off course) without making the user to download the full file. Image downloading a 400-700-1000 mbytes files in order to see just the beginning of it or the middle... not too helpful. So i took the youtube attitude and installed the MP4 module for nginx. For some reasons, this module returned during the compile phase the following error:

gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g  -D_LARGEFILE_SOURCE -DBUILDING_NGINX  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules -I src/mail \
                -o objs/addon/src/ngx_http_h264_streaming_module.o \
In file included from /home/kit/nginx_mod_h264_streaming-2.2.7//src/ngx_http_h264_streaming_module.c:2:
/home/kit/nginx_mod_h264_streaming-2.2.7//src/ngx_http_streaming_module.c: In function ‘ngx_streaming_handler’:
/home/kit/nginx_mod_h264_streaming-2.2.7//src/ngx_http_streaming_module.c:158: error: ‘ngx_http_request_t’ has no member named ‘zero_in_uri’
make[1]: *** [objs/addon/src/ngx_http_h264_streaming_module.o] Error 1
make[1]: Leaving directory `/home/kit/nginx-0.9.3'
make: *** [build] Error 2

Very easy to fix it... just edit with your favorite editor the /path_to/nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c and remove the following lines... don't worry you won't beak anything:

/* TODO: Win32 */
if (r->zero_in_uri)
    return NGX_DECLINED;

Try "make" again and that's it... in order to inspire myself i used this source.
Let me know your comments!

No comments:

Post a Comment