C#通过文件头判断flv文件

目录

效果

代码


效果

代码

private void button1_Click(object sender, EventArgs e)

{

string path = Application.StartupPath + "\\test.flv";

//3byte 总是FLV(0x46 0x4C 0x56)

byte\[\] Type = new byte3;

using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))

{

fs.Read(Type, 0, Type.Length);

}

String content = Encoding.ASCII.GetString(Type, 0, Type.Length);

}

复制代码
private void button1_Click(object sender, EventArgs e)
{
    string path = Application.StartupPath + "\\test.flv";

    //3byte 总是FLV(0x46 0x4C 0x56)
    byte[] Type = new byte[3];
    using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
    {
        fs.Read(Type, 0, Type.Length);
    }

    String content = Encoding.ASCII.GetString(Type, 0, Type.Length);

}

FLV格式参考:https://www.cnblogs.com/lidabo/p/9018548.html

相关推荐
爱写代码的小朋友27 分钟前
从零开始学 Win32 API:C++ 窗口编程实战(VS Code + MinGW-w64 命令行详解)
开发语言·c++
果汁华31 分钟前
Function Calling 与 Python 实战完整指南
开发语言·网络·python
小小晓.1 小时前
C++:语句和作用域
开发语言·c++
muddjsv2 小时前
SQLite数据库文件机制详解:journal、wal、shm文件作用与备份避坑
数据库·sqlite
wanderist.2 小时前
Lambda表达式在算法竞赛中的应用
java·开发语言·算法
海天鹰3 小时前
PHP上传文件
android·开发语言·php
吴声子夜歌3 小时前
MongoDB 4.2——应用程序设计
数据库·mongodb
数字新视界3 小时前
动环监控可视化在数据中心管理中的应用与实践解析
数据库·物联网·解决方案·动环监控·大榕树
极地野狼 音乐哔哔3 小时前
数据库备份恢复的原理实践
数据库
互联网中的一颗神经元3 小时前
小白python入门 - 25. SQL 与表设计入门
数据库·python·sql