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

相关推荐
福大大架构师每日一题10 分钟前
agno v2.8.7 发布:顾问模型、精准路线、调度能力全面升级,10项关键修复一次看懂
java·开发语言·数据库
深念Y17 分钟前
老Flyme 官方 root 开启 ADB TCP 方案
linux·数据库·网络协议·tcp/ip·adb·智能手机·emmc
老洋葱Mr_Onion18 分钟前
【C++】CSP-J复赛dp问题(含模板题)
开发语言·c++
c238568 小时前
MySQL 基础用法(上):库表管理与数据增删改
c语言·数据库·c++·mysql
李永奉8 小时前
C语言-嵌入式开发C语言常用预处理指令合集
c语言·开发语言
上海安当技术9 小时前
敏感数据怎么防拖库?信封加密(DEK+KEK 二层密钥)架构设计与 Java 实战
java·开发语言·python
jnrjian9 小时前
postgres database 更换用户
数据库·postgresql
我是唐青枫9 小时前
Java JCommander 实战详解:用注解解析命令行参数
java·开发语言
大鹏说大话9 小时前
C++ 内存布局详解:类、虚函数、虚表底层原理
java·开发语言
键盘会跳舞10 小时前
C++:容器适配器 queue 的源码级拆解
开发语言·c++·queue