[英]Upload Different Video Formats
How would I know if a video was taken with a phone, camcorder, or something else? 我怎么知道视频是用手机,便携式摄像机或其他东西拍摄的? I have an intranet site done in C# that users upload educational videos.
我有一个用C#完成的Intranet网站,用户可以上传教育视频。 The videos were taken with smartphone, cameras, VCR converted to digital format etc.
这些视频是使用智能手机,相机,转换成数字格式的VCR等拍摄的。
You can read the file header, in search for info it contains, for example a MPEG video has a header format like this: MPEG HEADER FORMAT . 您可以阅读文件标题,以搜索其中包含的信息,例如MPEG视频具有这样的标题格式: MPEG HEADER FORMAT 。
Sometimes the devices puts some information about itself in "user data" section, like a camera, who sometimes put the camera model. 有时设备会在“用户数据”部分中放置一些有关自身的信息,例如照相机,有时会放置照相机模型。
-->Edit<-- How we can read header? ->编辑<-如何读取标题?
for example, if you have this format 例如,如果您使用这种格式
you can do something like this: 您可以执行以下操作:
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);
}
}
}
I hope to be helpful. 希望对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.