# Nginx and X-Accel-Redirect to serve Quicktime streaming prepared movies

**URL:** <https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837>\
**Category:** NGINX\
**Created:** [June 19, 2008, 2:32am UTC](https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837 "2008-06-19T02:32:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@thomas](https://www.ruby-forum.com/u/thomas)\
**Post date:** [June 19, 2008, 2:32am UTC](https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837/1 "2008-06-19T02:32:28Z")

</div>

Hi,

Using Nginx + X-Accel\_Redirect + Regular Quicktime movies works, but  
the user needs to wait for the film to be fully downloaded to watch  
it.

Therefore I decided to prepare my movies with the Fast-Start option,  
but the movies load barely a few bytes and take ages to play.

Do I need to adjust the content headers or do I need to move to flash  
for streaming and using x-accel-redirect?

---

<div class="post-metadata">

**Author:** ![thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@thomas](https://www.ruby-forum.com/u/thomas)\
**Post date:** [June 21, 2010, 9:22pm UTC](https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837/2 "2010-06-21T21:22:48Z")

</div>

Thomas wrote:

> Hi,
> 
> Using Nginx + X-Accel\_Redirect + Regular Quicktime movies works, but  
> the user needs to wait for the film to be fully downloaded to watch  
> it.
> 
> Therefore I decided to prepare my movies with the Fast-Start option,  
> but the movies load barely a few bytes and take ages to play.
> 
> Do I need to adjust the content headers or do I need to move to flash  
> for streaming and using x-accel-redirect?

I ended in this thread from google. Does anyone know how to stream  
h.264/mp4 movies to Quicktime player using Nginx+X-Accel-Redirect? I’m  
experiencing the same problem.

Does it have anything to do with the moov stuff not at the correct place  
in the video?

Cheers,

---

<div class="post-metadata">

**Author:** ![thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@thomas](https://www.ruby-forum.com/u/thomas)\
**Post date:** [June 21, 2010, 10:00pm UTC](https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837/3 "2010-06-21T22:00:58Z")

</div>

> Does it have anything to do with the moov stuff not at the correct place  
> in the video?
> 
> Cheers,

By mooving with mp4box I was able to get progressive download. But it  
seems that when I go through X-Accel-Redirect I lose the real streaming  
ability.

---

<div class="post-metadata">

**Author:** ![thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@thomas](https://www.ruby-forum.com/u/thomas)\
**Post date:** [June 21, 2010, 11:26pm UTC](https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837/4 "2010-06-21T23:26:35Z")

</div>

I have found this Rails plugin to easily use X-Accel-Redirect:

> **[GitHub - IceskYsl/Nginx-X-Accel-Redirect: Nginx-X-Accel-Redirect is a plugin...](https://github.com/IceskYsl/Nginx-X-Accel-Redirect)**
>
> Nginx-X-Accel-Redirect is a plugin for rails to send file via nginx. - GitHub - IceskYsl/Nginx-X-Accel-Redirect: Nginx-X-Accel-Redirect is a plugin for rails to send file via nginx.

So it seems that I might be missing some headers in order to correctly  
stream videos?

For http streaming to work with html5, the web server must be able to  
server byte-range requests. I know Nginx can do it because I tried it.  
Now the thing is to configure stuff correctly so it can do its job.

---

<div class="post-metadata">

**Author:** ![thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@thomas](https://www.ruby-forum.com/u/thomas)\
**Post date:** [June 22, 2010, 3:22pm UTC](https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837/5 "2010-06-22T15:22:33Z")

</div>

Here is a video I am trying to stream and enable seeking:  
[http://www.digiprof.tv/uploads/assets/94/original/tie\_knot.mp4](http://www.digiprof.tv/uploads/assets/94/original/tie_knot.mp4)

This one doesn’t go through X-Accel-Redirect, and it was hinted using  
mp4box. Any idea?

---

<div class="post-metadata">

**Author:** ![thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@thomas](https://www.ruby-forum.com/u/thomas)\
**Post date:** [June 23, 2010, 12:07pm UTC](https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837/6 "2010-06-23T12:07:59Z")

</div>

> I can’t make it yet work with mp4 files (hmmm iphone)  
> Argh! So stupid! There is the mp4 module for that!

---

<div class="post-metadata">

**Author:** ![thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@thomas](https://www.ruby-forum.com/u/thomas)\
**Post date:** [June 22, 2010, 10:36pm UTC](https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837/7 "2010-06-22T22:36:43Z")

</div>

Ok new test with ogg/theora this time.

Here is my video:  
[http://www.digiprof.tv/streams/restricteds/9/houmos.ogv](http://www.digiprof.tv/streams/restricteds/9/houmos.ogv)

FF3.6 users should see it appear in the html5 video player, but it’s not  
the case.

Here is an example of an ogg/theora video being correctly served (by  
apache): [http://clips.vorwaerts-gmbh.de/big\_buck\_bunny.ogv](http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv)

What am I missing? Is it a content type problem? They seem properly set  
in my conf file. Other headers maybe? Why is nginx proposing to download  
the file instead of streaming it?

Cheers,

---

<div class="post-metadata">

**Author:** ![thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@thomas](https://www.ruby-forum.com/u/thomas)\
**Post date:** [June 24, 2010, 2:01pm UTC](https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837/8 "2010-06-24T14:01:12Z")

</div>

Fernando P. wrote:

> > I can’t make it yet work with mp4 files (hmmm iphone)  
> > Argh! So stupid! There is the mp4 module for that!  
> > Hmm it seems the module is made for Flashplayer.

Anyway I tested youtube’s html5 feature (h264 videos) and we cannot  
scrub the timeline outside of the downloaded zone, so I guess it’s a  
limitation of Quicktime 7.6.6. Maybe it works with QuicktimeX and  
iphones, but as I don’t have anything to test I can’t confirm.

---

<div class="post-metadata">

**Author:** ![thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@thomas](https://www.ruby-forum.com/u/thomas)\
**Post date:** [June 22, 2010, 11:47pm UTC](https://www.ruby-forum.com/t/nginx-and-x-accel-redirect-to-serve-quicktime-streaming-prepared-movies/140837/9 "2010-06-22T23:47:17Z")

</div>

Fernando P. wrote:

> Ok new test with ogg/theora this time.
> 
> Here is my video:  
> [http://www.digiprof.tv/streams/restricteds/9/houmos.ogv](http://www.digiprof.tv/streams/restricteds/9/houmos.ogv)

It works! Sorry I don’t know what made it work, maybe a header problem  
which was not getting updated due to some caching? Maybe I forgot to  
restart nginx after adjusting its configuration? Anyway Nginx can stream  
ogg/theora videos and let the users seek inside the video!

I can’t make it yet work with mp4 files (hmmm iphone), probably because  
the video is not properly encoded for being streamed to the web. I’ll  
dig into that tomorrow: moov, fast-start, etc… all painful stuff to  
take care of.

Cheers,
