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