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

相关推荐
叶小鸡4 分钟前
Java 篇-项目实战-AI 天机学堂(从 0 到 1)-day5
数据库·redis·缓存
njsgcs5 分钟前
c# solidworks 工程图获得展开视图不在固定面螺纹特征的位置
开发语言·c#·solidworks
qq_85730581923 分钟前
python语法
开发语言·python·算法
mN9B2uk1723 分钟前
大数据量高并发的数据库优化
服务器·数据库·oracle
Database_Cool_26 分钟前
PolarSearch AutoETL:让数据库内置搜索不再需要搬运工
数据库
AI行业学习37 分钟前
CC-Switch v3.16.1 官方下载 | 安装配置详细教程【2026.6.10】
java·开发语言·vue.js·python·mysql·eclipse·html
cui17875681 小时前
物业费收缴困局的破题之路:2026年社区商业逻辑的底层重构
大数据·数据库·人工智能
周杰伦的稻香1 小时前
Go + Redis:本地部署高性能图片主色调提取服务
开发语言·redis·golang
吴梓穆1 小时前
Python 语法基础 函数
开发语言·python
不负岁月无痕1 小时前
C++ 模板核心内容与高频面试题汇总
java·开发语言·c++