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

目录

效果

代码


效果

代码

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);

}

复制代码
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

相关推荐
Wadli几秒前
Oncall Agent项目
开发语言
艾莉丝努力练剑5 分钟前
【QT】Qt常用控件与布局管理深度解析:从原理到实践的架构思考
linux·运维·服务器·开发语言·网络·qt·架构
CV艺术家5 分钟前
java原mysql切换国产达梦数据库
数据库·mysql
好大哥呀5 分钟前
如何在Spring Boot中配置数据库连接?
数据库·spring boot·后端
杜子不疼.7 分钟前
用 Python 实现 RAG:从文档加载到语义检索全流程
开发语言·人工智能·python
chao1898447 分钟前
基于改进二进制粒子群算法的含需求响应机组组合问题MATLAB实现
开发语言·算法·matlab
lcj25118 分钟前
字符函数,字符串函数,内存函数
c语言·开发语言·c++·windows
独特的螺狮粉8 分钟前
古诗词飞花令随机出题小助手:鸿蒙Flutter框架 实现的古诗词游戏应用
开发语言·flutter·游戏·华为·架构·开源·harmonyos
cch891811 分钟前
C++、Python与汇编语言终极对比
java·开发语言·jvm
xcLeigh11 分钟前
IoTDB数据订阅API实战:实时消费数据+TsFile订阅全攻略
数据库·api·iotdb·数据备份·tsfile·数据订阅