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

相关推荐
Trouvaille ~4 分钟前
【Redis篇】Redis 主从复制:数据同步的原理与实现
数据库·redis·缓存·中间件·高可用·主从复制·后端开发
原来是猿12 分钟前
深入理解 C++ unordered_map 与 unordered_set
开发语言·c++
满天星830357713 分钟前
【Qt】信号和槽 (一)(概述和基本使用)
开发语言·c++·qt
l1t22 分钟前
DeepSeek总结的 waddler,一个 Go 语言编写的从 YAML 文件运行的 ETL 管道
开发语言·golang·etl
真实的菜22 分钟前
Redis 从入门到精通(五):哨兵模式(Sentinel)—— 自动故障转移的完整原理与实战
数据库·redis·sentinel
FlyWIHTSKY38 分钟前
React 19 + Next.js 16(App Router)项目中集成 MSW
开发语言·javascript·vue.js
唔6638 分钟前
(二)补充完整的数据库、中间件、MQTT、JAR后台和Web前端的部署脚本,全部一键自动化。
数据库·中间件·jar
六月雨滴40 分钟前
Oracle 内存优化
数据库·oracle
Mr.Daozhi43 分钟前
跨境电商选品完整流水线:Google Trends筛词+Meta广告分析,CLI工具设计实战
开发语言·爬虫·python·跨境电商·工具链·选品
多彩电脑43 分钟前
Swift里字符串的索引
开发语言·swift