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

相关推荐
小冯不疯1 分钟前
集成中心架构:PULL × PUSH × 集成转换的三大引擎
数据库·架构
栈帧之外7 分钟前
【C++】红黑树实现
开发语言·c++
程序员老陆9 分钟前
C++中同一个回调函数被多个设备并发调用:并发问题不在“函数”,而在“状态”
开发语言·c++·程序设计
tryxr11 分钟前
数据库如何通过 MVCC 实现隔离性
数据库·mysql·mvcc·隔离性
wangchunyu11412 分钟前
JDK8新特性实战(Lambda、Stream、Optional)
java·开发语言
鱼宵15 分钟前
工厂模式实战:消灭魔法数字,把写死的 new 收进一个厂里
开发语言·python
yeflx23 分钟前
Ubuntu22.04安装Mysql Workbench
数据库·mysql·adb
PaperData25 分钟前
1986-2025年《中国能源统计年鉴》全年份pdf+excel版
数据库·能源
niucloud-admin26 分钟前
NIUCLOUD LITE AI开发文档--后台系统结构
开发语言
Wang's Blog30 分钟前
Java 项目实战: 交友项目 - 登录发送验证码的测试验证与经验复盘
java·开发语言·交友