我怎么知道视频是用电话、摄像机还是其他东西拍摄的呢?我有一个用C#做的内联网网站,用户可以上传教育视频。这些视频是用智能手机、相机、录像机转换成数字格式等拍摄的。
发布于 2013-12-26 03:38:02
您可以读取文件头,以搜索其中包含的信息,例如,MPEG视频具有如下所示的头格式:MPEG报头格式。
有时,设备会在“用户数据”部分放置一些关于自己的信息,比如相机,后者有时会放置相机模型。
->编辑<-我们怎么读标题?
例如,如果您有以下格式
你可以这样做:
using System;
using System.IO;
namespace HeaderReader
{
class Program
{
static void Main(string[] args)
{
byte[] bytesFile = new byte[7]; // Read the first 7 Bytes
using (FileStream FileS = File.OpenRead("MyFile")) //the uploaded file
{
FileS.Read(bytesFile, 0, 7);
FileS.Close();
}
string data = BitConverter.ToString(bytesFile); //convert data to get info
Console.WriteLine("This is the data:" + data);
}
}
}
我希望能有所帮助。
https://stackoverflow.com/questions/20778645
复制相似问题