3

The problem is that when video's get bigger than a minute or two I have to buffer the entire video before I can actually play it. When playing very small video's this isn't the case, and I can skip ahead within the buffered part.

I'm playing the video's inside chrome, and the video's are of .mp4 type.

How would I fix this?

Edit:

It turns out that a subset of H.264 files have the index at the end, which means that you cannot skip ahead until the full file is downloaded. I would have to swap the index according to:

MediaElement.js - Flash Video Wont Play Until Fully Loaded

However, I'm allowing my users to upload movies themselves so I cannot ask them to use this program. How would I convert it myself using php code?

Edit 2:

I found a library that enables me to change position of the moov atom. For anyone struggling with the same problem use the following library:

http://code.google.com/p/moovrelocator/

Edit 3:

I can confirm the library works great. Definitely recommend it.

Community
  • 1
  • 1
user1534664
  • 3,258
  • 8
  • 40
  • 66
  • Can you tell which media format, which browser(s) and probably even provide a link to an example media file on the web we can try? – Marcel Jan 10 '13 at 07:12
  • 1
    .mp4, chrome, and im sorry I cant put it on the web. It's running on localhost at the moment because its being used within a testing environment. – user1534664 Jan 10 '13 at 07:14
  • The question you linked already provides you with an answer. Just convert the uploaded videos with one of the programs mentioned and you should be good. – Carsten Jan 10 '13 at 11:36
  • @Carsten I have a site where users can upload there own video's. I think this process can be done automatically with code instead of my users or me having to use the program. – user1534664 Jan 10 '13 at 12:07
  • That's what I was trying to say. I don't see where your problem is. Let me try to rephrase it: A user uploads a video. When the upload is completed, you convert the video on the server, using one of the programs from your linked question. Now you have a video file with the index at the beginning, without any manual intervention from you or the user. – Carsten Jan 10 '13 at 12:11
  • @Carsten (Sorry to sound like a beginner) You mean its possible to program it so to run that program on my server once the movie is uploaded? I always thought you had to use library's/API's to achieve such things.. – user1534664 Jan 10 '13 at 12:18
  • Well yes. To invoke external programs from PHP, you can use the [`exec()`](http://php.net/manual/en/function.exec.php) function. – Carsten Jan 10 '13 at 12:22

2 Answers2

0

Like Carsten said you can use the exec() function. However, I used the moovrelocator library.

user1534664
  • 3,258
  • 8
  • 40
  • 66
0

I used http://renaun.com/blog/code/qtindexswapper/ to recode an mp4 video for flash and ie and it worked perfectly. It starts playing as soon as you hit the play button.