jasonmc / forked-daapd

A re-write of the firefly media server (mt-daapd). It's released under GPLv2+. Please note that this git repository is a mirror of the official one at git://git.debian.org/~jblache/forked-daapd.git
http://blog.technologeek.org/2009/06/12/217
GNU General Public License v2.0
328 stars 45 forks source link

Cannot play mp4 video from forked-daapd #13

Open franklai opened 13 years ago

franklai commented 13 years ago

a mp4 video file with codec h.264/AAC can be listed in database and Movies. but double click cannot play this video. both iTunes 9.2.1 and 10.

jodyfanning commented 12 years ago

I have this same issue. I have videos that play locally in iTunes (Windows x64). But when I copy them to the server (Ubuntu, forked-daapd 0.19) they don't play. I tried disabling transcoding for that type and anything else I could think of and it doesn't work. Streaming Mp3 files works fine from the same server.

I get this in the log (info level)

[2012-03-11 16:58:33] httpd: Preparing to stream /home/public/media/video.mp4 [2012-03-11 16:58:33] httpd: Kicking off streaming for /home/public/media/video.mp4 [2012-03-11 16:58:33] httpd: Preparing to stream /home/public/media/video.mp4 [2012-03-11 16:58:33] httpd: Kicking off streaming for /home/public/media/video.mp4 [2012-03-11 16:58:34] httpd: Preparing to stream /home/public/media/video.mp4 [2012-03-11 16:58:34] httpd: Kicking off streaming for /home/public/media/video.mp4 [2012-03-11 16:58:35] httpd: Done streaming file id 7873

For some reason it does it three times. Even on the debug logging level it shows that it is streaming, but iTunes just never actually shows anything...

[2012-03-11 16:51:50] httpd: Read 65536 bytes; streaming file id 7873

veryLittleTime commented 12 years ago

I've also noticed that video play back does not work with iTunes 10.6.1.7 and forked-daapd-0.19. Looking through some Wireshark traces, I see there is an HTTP user-agent being used by iTunes not listed in function transcode_needed(). I also noticed that Transfer-Encoding is not being used by iTunes Home Sharing feature when sharing videos.

When Transfer-Encoding is removed

$ diff -u ~/forked-daapd-0.19/src/evhttp/http.c ./evhttp/http.c --- /home/vlt/forked-daapd-0.19/src/evhttp/http.c 2011-09-11 06:46:25.000000000 -0700 +++ ./evhttp/http.c     2012-04-11 09:54:07.000000000 -0700 @@ -2006,12 +2006,15 @@      evhttp_connection_stop_detectclose(req->evcon);         evhttp_responsecode(req, code, reason); +#if 0 +    /* Video play back on iTunes 10.6.1.7 works if Transfer-Encoding is +not used. /      if (req->major == 1 && req->minor == 1) {            /_ use chunked encoding for HTTP/1.1 */            evhttp_add_header(req->output_headers, "Transfer-Encoding",                "chunked");            req->chunked = 1;      } +#endif      evhttp_make_header(req->evcon, req);      evhttp_write_buffer(req->evcon, NULL, NULL);  }   and new user agent is added   $ diff -u ~/forked-daapd-0.19/src/transcode.c ./transcode.c --- /home/vlt/forked-daapd-0.19/src/transcode.c     2011-09-11 06:46:25.000000000 -0700 +++ ./transcode.c 2012-04-11 09:01:18.000000000 -0700 @@ -587,6 +587,12 @@               client_codecs = roku_codecs;          } +      else if (strncmp(user_agent, "AppleCoreMedia", strlen("AppleCoreMedia")) == 0) +        { +          DPRINTF(E_DBG, L_XCODE, "Client is a AppleCoreMedia, using

The above is not a fix for this issue but might spark an idea to the solution.