问题描述
我正在尝试在我的网站上播放.h264文件(后缀为.h264的文件,而不是.mp4!)有什么办法可以做到这一点? html标记似乎不支持它.
I am trying to play a .h264 file on my website(A file with .h264 suffix, not .mp4!) Is there any way I can do this? The html tag doesn't seem to support it.
该网站在Raspberry pi上运行,并且无法将其自动转换为mp4,因为它将使后端崩溃.这些视频是由安装在树莓派上的摄像头生成的.
The website is running on a Raspberry pi, and it impossible to convert them automatically to mp4, because it will crash the backend. The videos are generated by a camera mounted on the raspberry pi.
html:
% if loaded_video is not None:
<video width="720" height="480" controls>
<source src="/movies/{{loaded_video.name}}" type="video/mp4" />
Your browser does not support the video tag.
</video>
即使直接加载视频网址时,我所看到的还是乱码.
Even when loading the video url directly, all I see is gibberish.
有人可以帮助我吗?谢谢
Can anyone help me?Thanks
推荐答案
您可以使用百老汇脚本javascript h264解码器端口在浏览器中显示h264文件.如果您寻求实时性,则还需要一个websocket服务器/中继,并确保发送正确的分块NAL(h264帧).我为此目的编写了一个项目(使用原始h264从rpi cam到浏览器的实时流),请参见"github h264-live-player"
You can use the broadway emscripten javascript h264 decoder port to display h264 files in a browser. If you seek for real-time, you'll also need a websocket server/relay and make sure you are sending properly chunked NAL (h264 frames). I wrote a project for this very precise purpose (live stream from rpi cam to a browser using raw h264), see "github h264-live-player"
这篇关于播放.h264文件网络播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!