如何将视频存储在数据库中 [英] how to store videos in database

查看:1201
本文介绍了如何将视频存储在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将视频存储在数据库中,然后如何通过单击将其播放.就像在YouTube

How can i store videos in database and then how can i play it by clicking on it. just like in YouTube

推荐答案

Don''t

不要将文件存储在数据库中,我会看到很多此类问题,而且我从未见过这样做的充分理由.

将视频文件的位置存储在数据库中.

您可能想看一下这篇文章
使用ASP.NET处理程序将视频文件上传并转换为Flash Video(flv)和渐进式流 [ ^ ]
Don''t

Do not store files in a database, I see this type of question alot and I''ve never seen a good reason to do so.

Store the location of the video-file in the database.

You might want to look at this article
Upload and Convert Video file to Flash Video (flv) and Progressive Streaming using ASP.NET handler[^]


您要问的是一项艰巨的任务,而这是不可能完成的任务.最好是为您的视频提供一个文件服务器,使用Guid为每个文件命名(当您通过在网页上说FileUpload将其保存到文件服务器时),然后将该Guid存储在记录中,并在其中包含文件的详细信息您的数据库.例如,您的表将包括:

VideoId-表格的主键和实际视频文件的文件名的Guid.
名称-视频的名称,大概由用户指定
说明-如上所述,但说明
时长-保存文件时的时长,以备后用,例如对视频排序很有用
标记-您可能希望标记用户?

您希望做的是一项艰巨的任务,如果您自己不能自己解决这个问题,我真的建议您从简单的事情开始.

祝您好运,考虑到YouTube归Google所有,对我来说听起来很疯狂,

希望这会有所帮助,埃德:)
What you''re asking is an immense task and one that is impossible how you want to go about doing it. Far better would be to have a file server for your videos, name each file (when you save it to your file server by say FileUpload in a web page) with a Guid then store that Guid in a record with the details fo the file in your database. For example your table would include:

VideoId - Both the primary key of the table and the Guid of the file name for the actual video file.
Name - The name of the video, specified by a user presumably
Description - As above but a description
Duration - Store the duration of the file when you save it for later use, can be useful for sorting videos for example
Tags - You may wish to tag users?

What you wish to do is an immense task and I really would suggest you start with something easier if you weren''t able to work this one out for yourself.

Best of luck, taking on YouTube sounds crazy to me given that it''s owned by Google,

Hope this helps, Ed :)


这篇关于如何将视频存储在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆