PHP 时间记录

发布于 2024-11-28 00:46:15 字数 349 浏览 1 评论 0原文

在我的网站上,我使用视频播放器 (flowplayer),并且我的剪辑采用 .flv 格式。 我的问题是,是否有任何方法可以创建 php 文件来从 .flv 读取/流式传输数据?就像 feed.php?vid=123

(是的,我知道这可以通过在本地打开文件并输出来完成但这里有一个问题

用户在流式传输的每一分钟,我想把这些信息存入mysql。我该怎么做?也许使用循环并分块读取文件? ( while() ... ? )

是的,我知道我可以使用 javascript 做到这一点,但是人们可以使用自己的播放器直接窃取我的 .flv 并占用我的带宽。

On my site there I'm using a video player (flowplayer), and my clips are in .flv format.
My question is if there is any way I can create php file which will read/stream data from .flv? Like feed.php?vid=123

(Yes i know this can be done by opening file locally and outputing it but here is the catch)

Every minute the user is streaming, I want to put that information into mysql. How can I do this? Maybe using a loop and reading file in chunks? ( while() ... ? )

Yes, I know I could do this using javascript, but people could steal my .flv directly by using own player and eat my bandwidth.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮世清欢 2024-12-05 00:46:15

如果您提供字节,则可以复制并存储字节。您无法防止网站上的数据被盗,因为不提供数据的网站在逻辑上是不可能的。

您可以记录已发送出多少块,但“X 字节 = Y 秒”之间没有直接关联,因为视频压缩比取决于内容。您需要以某种方式解析 .flv 数据并计算出已发送了多少帧,然后您可以从中计算出已显示多少秒/分钟。

一旦你弄清楚了这一点,那么记录“播放时间”将是你最不关心的问题。

If you're serving up bytes, the bytes can be copied and stored. You can NOT prevent theft of data on a website, because a website which does not serve up data is a logical impossibility.

You can record how many chunks have been sent out, but there's no direct correlation between "X bytes = Y seconds", because video compression ratios are content-dependent. You'd need to parse the .flv data somehow and figure out how many frames have been sent, from which you can then figure out how many seconds/minutes have been displayed.

Once you've got that figured out, then recording "play times" will be the least of your problems.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文