简体   繁体   中英

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. The videos were taken with smartphone, cameras, VCR converted to digital format etc.

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM