流 AVI 文件的问题 [英] Issue with streaming AVI files
问题描述
我正在编写一个视频流服务器应用程序.我有一个 AVI 文件,我已经把它放在 IIS 7 上进行流式传输.我发现如果媒体尚未缓冲,客户端无法跳转到媒体的任意位置.我认为录制过程中缺少某些元数据?
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?
经过搜索,我认为Windows Media Player在本地缓冲之前无法跳转到任何任意位置,因为AVI的索引块(需要搜索)存储在文件末尾.
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.
举个例子,如果我录制的avi视频是10分钟,现在播放到第4分钟,本地缓存的流媒体缓存到第5分钟,第5分钟后我无法跳转到任何时间,就像 Windows Media Player 中的第 7 分钟一样.
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.
我在使用 asf/wmv 等其他格式时没有遇到同样的问题.所以我认为这是一个 AVI 问题,而不是服务器或任何其他环境问题.
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.
我的问题是,
- AVI 文件在缓冲之前无法跳转到任意位置的实际原因是什么?
- 任何解决方案或变通方法?我可以改用其他更聪明的播放器吗,它们可以解决这个问题,或者我可以在服务器端添加一些代码修复吗?
推荐答案
正如您已经发现的那样,索引写在 avi 容器的末尾.这就是为什么 avi 格式不适合流式传输的原因.
As you already discovered yourself, index is written at the end of avi containers. That's why avi format is not good for streaming.
您应该将视频转换为其他格式,该格式在开头具有索引信息.例如flv、wmv、ogg/theora等
You should convert your video to some other format which has the indexing information at the beginning. For example, flv, wmv, ogg/theora, etc.
这篇关于流 AVI 文件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!