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

相关推荐
wordpress资料库4 分钟前
Next.js更适合移动开发 不适合web开发
开发语言·前端·javascript·next.js
wujf905 分钟前
Go 内存泄漏排查完整教程 (pprof)
开发语言·golang·xcode
kisbad6 分钟前
Day 012|Embedding 和向量数据库:知识库检索到底在检什么
数据库·python·embedding·agent
言乐617 分钟前
Python实现基本搜索引擎
java·linux·开发语言·python·搜索引擎
谷禾牛博20 分钟前
肠道菌群检测流程及差异和技术门槛在哪里?
数据库·经验分享·功能测试
Zhu75835 分钟前
对docker环境的postgresql数据库做快速初始化
数据库·docker·postgresql
Wang's Blog1 小时前
Go-Zero项目开发5: 数据库与缓存一致性问题及 go-zero 缓存机制解析
数据库·缓存·golang
小灰灰搞电子1 小时前
C++ boost::range 详解:基于最新版本的现代范围处理指南
开发语言·c++
ch.ju1 小时前
Java Programming Chapter 4——lambda expression
java·开发语言