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

相关推荐
布吉岛的石头8 分钟前
Java 程序员第 50 阶段3:数据工程:预训练语料清洗与去重
java·开发语言·人工智能·深度学习·transformer
benchmark_cc15 分钟前
QuantDash 安装成功后,如何验证 Python 环境可以正常导入 SDK?
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
学逆向的28 分钟前
C 内存属性
c语言·开发语言·算法·网络安全
泡海椒43 分钟前
JQuick-SQL 与关系型数据库集成:应用层读取后注册查询
数据库·sql
Carol063043 分钟前
上肢及肩肘关节
java·服务器·数据库
鸽芷咕1 小时前
数据孤岛怎么拆?金仓KFS数据集成软件从原理到落地
数据库
一世繁华行1 小时前
CAPL浏览器(翻译自官方文档)
运维·服务器·数据库
得助智能-垂类大模型1 小时前
多Agent平台哪家做得好?2026年企业级多智能体平台选型指南
大数据·数据库
阿松爱学习1 小时前
【Unity开发】Unity长截图功能实现
unity·c#·游戏引擎