将视频和元数据存储在数据库中 [英] Storing video and metadata in a database

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

问题描述

最近,我的老板带着一个新项目来到开发团队:



有必要将视频存储在数据库中以便对它们执行查询。



我们目前有很多关于DVD的视频,当我们需要的时候,我们需要搜索所有这些视频。



我们需要的是将单帧的视频和元数据存储在数据库中,以便能够对元数据执行查询并仅检索满足搜索条件的视频摘录。



您能否帮助我了解我们可以使用哪些工具来实现目标?



我们使用C#开发。

除其他外,元数据可以包含文本,日期,地理空间数据等。

我们需要使用H.264处理视频。

Recently my boss came to the team of developers with a new project:

"It is necessary to store videos in a database in order to perform queries on them".

We currently have many videos on DVDs and when we need something, we need to search in all of them.

What we need is to store videos and metadata of single frames in a database, in order to by able of perform queries upon the metadata and retrieve just the extracts of the video that fulfill the search criteria.

Could you please help me about which tools can we use to accomplish our target?

We develop using C#.
Among other things metadata can contain text, dates, geospatial data, etc.
We need to process the videos using H.264.

推荐答案

我建​​议将视频存储在文件中,并将唯一的文件名和元数据的一部分存储在数据库中。当然你也可以将视频存储在数据库中,就像blob一样,但我看不出它有多大意义。



现在,我不会搞砸从我自己检索媒体文件中的元数据。您认为只处理H.264。这不是它真正起作用的方式。 H.264只是算法之一,但也有媒体容器格式。媒体文件或流类型是容器类型;并且它可以组合一些不同类型的几个不同的流(例如音频,视频,字幕,具有不同压缩或甚至像素大小的视频流等);并且每个容器类型支持许多或一些有限的流/编解码器子集。实质上,没有H.264文件这样的东西。要了解一些信息,请参阅:

http://en.wikipedia.org/wiki/Digital_container_format [ ^ ],

http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC [ ^ ]。



那么,该怎么办?我通常建议使用一个可用的库或实用程序:

FFMpeg或libavcodec: http:// en。 wikipedia.org/wiki/Ffmpeg [ ^ ],

http://ffmpeg.org/ [ ^ ],

http:/ /en.wikipedia.org/wiki/Libavcodec [ ^ ],

http://libav.org/ [ ^ ]。



在这两种情况下,您都可以获得免费的开源实用程序几乎所有东西都可以。



现在,如何在.NET应用程序中以编程方式使用它?首先,您可以使用 System.Diagnostics.Process.Start 运行它来使用可用的实用程序:

http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx [ ^ ]。



如果这还不够好,你可以自己将库包装在.NET程序集中,或找到合适的包装器。请参阅:

http://www.ffmpeg-csharp.com/ [ ^ ],

http://sourceforge.net/projects/sharpffmpeg/ [ ^ ],

http://vbffmpegwrapper.codeplex.com/ [ ^ ]。



毕竟,尝试找一些: http://bit.ly/VpboUJ [ ^ ]。



如果你想工作在你自己的包装但不知道如何,问一个问题,我会给你基本的想法(使用P / Invoke或C ++ / CLI混合模式项目)。



另见我的过去答案:

如何使用Directshow修剪视频!? [ ^ ],

HTML5和Mime,流式传输视频? [ ^ ]。



祝你好运,

-SA
I would suggest storing video in files and storing the only the file name and perhaps some part of metadata in the database. Of course you could store the video in the database, too, as blobs, but I don't see much sense in it.

Now, I would not mess up with retrieving metadata from media files myself. You think that you just deal with H.264 only. This is not how it really works. H.264 is just one of the algorithms, but there are also media container formats. The media file or stream type is a container type; and it can combine several different streams (such as audio, video, captions, video streams with different compressions or even pixel sizes, etc.) of some different types; and each container type support many, or some limited subset of streams/codecs. In essence, there is no such thing as just "H.264 file". To get some idea, please see:
http://en.wikipedia.org/wiki/Digital_container_format[^],
http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC[^].

So, what to do? I usually advise to use one available library, or utility:
FFMpeg or libavcodec: http://en.wikipedia.org/wiki/Ffmpeg[^],
http://ffmpeg.org/[^],
http://en.wikipedia.org/wiki/Libavcodec[^],
http://libav.org/[^].

In both cases, you can get free open-source utilities which can make nearly everything.

Now, how to use it programmatically in a .NET application? First, you can use the available utility by running it using System.Diagnostics.Process.Start:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx[^].

If this is not good enough, you can wrap the library in a .NET assembly by yourself or find appropriate wrapper. Please see:
http://www.ffmpeg-csharp.com/[^],
http://sourceforge.net/projects/sharpffmpeg/[^],
http://vbffmpegwrapper.codeplex.com/[^].

After all, try to find some more: http://bit.ly/VpboUJ[^].

If you wish to work at such wrapper by yourself but don't know how, ask a question, I'll give you the basic ideas (using P/Invoke or C++/CLI "mixed-mode" project).

See also my past answers:
How to trim the video using Directshow!?[^],
HTML5 and Mime, Streaming a video?[^].

Good luck,
—SA


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

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