[英]Upload Different Video Formats
我怎么知道視頻是用手機,便攜式攝像機或其他東西拍攝的? 我有一個用C#完成的Intranet網站,用戶可以上傳教育視頻。 這些視頻是使用智能手機,相機,轉換成數字格式的VCR等拍攝的。
您可以閱讀文件標題,以搜索其中包含的信息,例如MPEG視頻具有這樣的標題格式: MPEG HEADER FORMAT 。
有時設備會在“用戶數據”部分中放置一些有關自身的信息,例如照相機,有時會放置照相機模型。
->編輯<-如何讀取標題?
例如,如果您使用這種格式
您可以執行以下操作:
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);
}
}
}
希望對您有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.