html5 video stream对视频的编码有什么特殊要求吗?

24 views
Skip to first unread message

Xi Shen

unread,
Apr 27, 2015, 8:19:35 AM4/27/15
to Shanghai Linux User Group
Hi,

第一次做video stream的Web app,遇到个问题。不知道是HTTP header信息不对,还是video codec有问题。

后台是用Play2 Scala写的。http header里加了"range", "accept-range", "content-length", "content-type"等。我在网上找了半天,觉得有用的都加上了。返回的http status是206 partial content。视频格式是mp4

前端是一个简单的html5,一个<video>。

现在的问题是,视频不能再游览器里播放。但是下载下来后,可以用播放器播放。


Thanks,
David

Xidorn Quan

unread,
Apr 27, 2015, 5:27:14 PM4/27/15
to sh...@googlegroups.com
如果浏览器没有指定Range,应该返回200而不能返回206吧。[1] 不要无谓地加header,并不是越多越好。

另外mp4也只是封装格式,你还需要确认里面封装的视频和音频编码格式是否被浏览器支持。可以用ffprobe或者mediainfo工具来查看。
- Xidorn

--
-- You received this message because you are subscribed to the Google Groups Shanghai Linux User Group group. To post to this group, send email to sh...@googlegroups.com. To unsubscribe from this group, send email to shlug+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/shlug?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shanghai Linux User Group”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到shlug+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

Xi Shen

unread,
Apr 27, 2015, 11:48:04 PM4/27/15
to sh...@googlegroups.com
嗯。原来的编码是mpeg4,但是html5不支持。我还一直以为是支持的。换成h264就好了。

Reply all
Reply to author
Forward
0 new messages