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

相关推荐
百***353311 小时前
PostgreSQL_安装部署
数据库·postgresql
rayylee13 小时前
生活抱怨与解决方案app
数据库·生活
molunnnn15 小时前
第四章 Agent的几种经典范式
开发语言·python
Lucifer三思而后行15 小时前
使用 BR 备份 TiDB 到 AWS S3 存储
数据库·tidb·aws
洛_尘15 小时前
JAVA EE初阶 2: 多线程-初阶
java·开发语言
百***170716 小时前
Oracle分页sql
数据库·sql·oracle
qq_4369621816 小时前
数据中台:打破企业数据孤岛,实现全域资产化的关键一步
数据库·人工智能·信息可视化·数据挖掘·数据分析
@卞16 小时前
C语言常见概念
c语言·开发语言
wjs202417 小时前
Eclipse 关闭项目详解
开发语言