简体   繁体   English

播放.h264文件网络播放器

[英]Play .h264 files webplayer

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? 我正在尝试在我的网站上播放.h264文件(后缀为.h264的文件,而不是.mp4!)有什么办法可以做到这一点? The html tag doesn't seem to support it. html标记似乎不支持它。

The website is running on a Raspberry pi, and it impossible to convert them automatically to mp4, because it will crash the backend. 该网站在Raspberry pi上运行,并且无法将它们自动转换为mp4,因为它将使后端崩溃。 The videos are generated by a camera mounted on the raspberry pi. 视频由安装在树莓派上的相机生成。

html: 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 谢谢

You can use the broadway emscripten javascript h264 decoder port to display h264 files in a browser. 您可以使用Broadway Emscripten javascript h264解码器端口在浏览器中显示h264文件。 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). 如果您寻求实时性,则还需要一个websocket服务器/中继,并确保发送正确的分块NAL(h264帧)。 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从rpi cam到浏览器的实时流),请参见“ github h264-live-player”

A web browser will not play a raw .264 file. Web浏览器将不会播放原始的.264文件。 It must be put into a container such as mp4. 必须将其放入mp4等容器中。 If it is live video, many moderns browsers can use media source extensions to play a fragmented mp4 (m4s) 如果是实时视频,许多现代浏览器可以使用媒体源扩展来播放片段化的mp4(m4s)

it impossible to convert them automatically to mp4, because it will crash the backend. 无法将它们自动转换为mp4,因为它将使后端崩溃。

Then this is a bug. 这是一个错误。 Fix the crash. 解决崩溃问题。

@sjagr @sjagr

Yes, h.264 is not royalty free, but wrapping it an an mp4 does not remove that restriction. 是的,h.264不是免版税的,但是将其包装为mp4并不会消除该限制。 *.264 is just h.264 NAULs saved in annexB format. * .264只是以annexB格式保存的h.264 NAUL。 It is part of the h.264 specification. 它是h.264规范的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM