Linux XBMC and Nginx compatibility issue [solved]
#1
This is part of a 4 month process of elimination tested on both 12.3 and 13.1 on Debian 7.5 and the results are the same.

I want to use Nginx to stream mp4s to multiple people. There is a combination of devices, from tablets to computers, but the results are mind boggling.

Nginx is compiled with mp4 support and rtmp support. Nginx config file looks like this

Code:
# HTTPS server
    #
    server {
    listen       443 ssl;
    server_name  localhost;
    include       mime.types;
    default_type  application/octet-stream;
    ssl_certificate      /usr/local/nginx/conf/server.crt;
    ssl_certificate_key  /usr/local/nginx/conf/server.key;
    ssl_session_cache    shared:SSL:5m;
    ssl_session_timeout  5m;
   ssl_ciphers  HIGH:!aNULL:!MD5;
   ssl_prefer_server_ciphers  on;

    location / {
    root   /path/to/movies/www/;
    # index  index.html index.htm;
     mp4;
    limit_rate_after 100m;
    limit_rate 5m;
    mp4_buffer_size     4M;
    mp4_max_buffer_size 10M;  
    autoindex on;
    allow all;
    access_log off;
    keepalive_timeout  65;
    keepalive_requests 200;
    reset_timedout_connection on;
    sendfile on;
    tcp_nopush on;
   gzip off;

Problem is simple. Some videos play, some don't, some formats like mp4 don't play at times, and at times, they do, avis play most of the time, but overall its anybody's guess which ones play and which ones don't. However, I have noticed that the ones to the bottom of index tend to be more problematic. When it fails to play, the error I get is...

Code:
T:3005724480  NOTICE: DVDPlayer: Opening: https://127.0.0.1/Movies/movie_title.mp4
21:12:42 T:3005724480 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
21:12:42 T:2417658688  NOTICE: Thread DVDPlayer start, auto delete: false
21:12:42 T:2417658688  NOTICE: Creating InputStream
21:12:42 T:2801023808   ERROR: CCurlFile::FillBuffer - Failed: HTTP response code said error(22)
21:12:42 T:2801023808  NOTICE: CCurlFile::FillBuffer - Reconnect, (re)try 1
21:12:42 T:2417658688  NOTICE: Creating Demuxer
21:12:42 T:2396154688  NOTICE: Thread FileCache start, auto delete: false
21:12:42 T:2801023808   ERROR: CCurlFile::FillBuffer - Failed: HTTP response code said error(22)
21:12:42 T:2801023808   ERROR: CCurlFile::CReadState::Connect, didn't get any data from stream.

But a standard hit with a browser has no issue.

Worse, XBMC has a habit of going on a tandem that results in this
Code:
T:2507144000   ERROR: CCurlFile::FillBuffer - Failed: HTTP response code said error(22)
21:13:08 T:2507144000   ERROR: CCurlFile::CReadState::Connect, didn't get any data from stream.
21:13:08 T:2507144000   ERROR: GetDirectory - Unable to get http directory
21:13:08 T:2507144000   ERROR: GetDirectory - Error getting https://127.0.0.1/TV_Series/TV_SHOW/TV_SHOWS01
21:13:08 T:2507144000   ERROR: CCurlFile::FillBuffer - Failed: HTTP response code said error(22)
21:13:08 T:2507144000  NOTICE: CCurlFile::FillBuffer - Reconnect, (re)try 1
21:13:08 T:2507144000   ERROR: CCurlFile::FillBuffer - Failed: HTTP response code said error(22)
21:13:08 T:2507144000   ERROR: CCurlFile::CReadState::Connect, didn't get any data from stream.

The proper hierarchy however should be TV_Series/TV_SHOW/S01/........

Now, has anybody seen anything like this? It does not happen with Apache, but nothing in Nginx is shooting an error. Are there known issues between XBMC and Nginx? Has anyone seen anything like this before?

Thanks.
Reply
#2
A combination of things.

For nginx, if you are using a self-signed SSL certificate as I was, you need to run this command

<code>
echo insecure >> ~/.curlrc
</code>

Then, never ever ever ever ever ever ever ever ever convert video with Handbrake if you plan on streaming them via XBMC. Use and only use FFMPEG or even Mencoder, but do not use Handbrake.

Finally, use the user-agent tag if you are using nginx. It actually works and nginx stops getting confused about things.
Reply
#3
out of curiosity - why doesn't it work with Handbrake? You can also encode videos with a generic profile/preset which will work with stock players and HW decoding on almost all devices. It's just that the high profile is not supported by all (like some older devices).
Reply
#4
As I have learnt from solving my issues, MP4s, regardless of codecs, encoded with Handbrake turn up without codec parameters when passed though SSL Nginx to XBMC. It could be a problem unique to me but this is what I was dealing with. Now, for some weird reason, this throws both Nginx and XBMC into a frenzy and while Nginx was serving the file as it should, XBMC perpetually rejected the file as being unplayable, per the log file. When I run all the files through FFMPEG, that problem ended. Now, I have a fairly new machine with an i5 so, that wasn't the issue and the only culprit that was common to me was Handbrake. I eliminated it from the picture, and voila. Note, this problem did not occur when the file was loaded directly, through SSH or with a different web server, and I tried Apache and Lighty.
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC and Nginx compatibility issue [solved]0