问题
I am writing a video streaming server application. I have an AVI file and I have put it on IIS 7 for streaming. I found that client cannot jump to an arbitrary location of the media, if the media is not buffered already. I think some meta-data is missing during recording?
After searching, I think, Windows Media Player could not jump to any arbitrary location before buffered locally, since Index block of AVI (needed for seeking) is stored at the end of file.
Here is an example, if my recorded avi video is 10 mins, and now I am playing to the 4th mins, and the local buffered streaming media is buffered to the 5th mins, I cannot jump to any time after the 5th mins, like the 7th mins in Windows Media Player.
I did not face the same issue with other formats like asf/wmv. So I think it is an AVI issue rather than server or any other environmental issue.
My questions are,
- What is the actual reason for not being able to jump to arbitrary location for AVI file, before it is buffered?
- Any solutions or workarounds? Can I use other smarter players instead, which can handle this issue or can I add some code fix at the server side?
回答1:
As you already discovered yourself, index is written at the end of avi containers. That's why avi format is not good for streaming.
You should convert your video to some other format which has the indexing information at the beginning. For example, flv, wmv, ogg/theora, etc.
来源:https://stackoverflow.com/questions/743220/issue-with-streaming-avi-files