Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running video streaming with lighttpd & mod_h264 on CentOS. Now, I want to set to client can only watch the movie for the first x minutes. Example: 10 minutes. Who can give me a solution for this? Thanks !

share|improve this question

You can set the start and end parameters as part of the url

Which should start the video at 0 and let it run for 10 minutes.

It may be better to use a preview link and some server side rewriting though as the above could easily be adjusted manually.

Enable url rewriting by having "mod_rewrite" as part of the server.modules.

Add this

url.rewrite = (
"(.*)/preview$" => "$1?start=0&end=600"

which, given a url like

will provide the first 10 minutes of the file.

share|improve this answer
Thanks to @lain, But How to hidden this "start=0&end=600" or /preview or generate new link for prevent hotlink? – longser Aug 25 '12 at 13:47
@longser: I already answered that - Make your preview URL end in /preview and then use the url.rewrite rule I provided. – Iain Aug 25 '12 at 13:54
@lain I think what he is asking is how can you prevent someone from hitting the url /video.mp4?start=15&end=600 directly. I don't see where the solution outlined would do this, but maybe I am missing something. – BrianV Nov 17 '12 at 13:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.