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

相关推荐
abc123456sdggfd8 分钟前
HTML5中Vuex持久化插件中WebStorage的底层配置
jvm·数据库·python
良木生香8 分钟前
【C++初阶】:STL——String从入门到应用完全指南(3)
c语言·开发语言·数据结构·c++·算法
pele10 分钟前
Go语言如何发GET请求_Go语言HTTP GET请求教程【总结】
jvm·数据库·python
weixin_5806140011 分钟前
Go 语言中 go install 命令的正确用法与常见误区详解
jvm·数据库·python
qq_6543669811 分钟前
Bootstrap 5移除jQuery依赖 Bootstrap 5如何不使用jQuery
jvm·数据库·python
m0_6765443814 分钟前
CSS如何实现元素悬浮在页面底部_利用fixed定位与底部间距
jvm·数据库·python
weixin_5689960614 分钟前
Redis怎样监控当前发生了多少次内存驱逐
jvm·数据库·python
2301_7965885015 分钟前
CSS如何制作导航栏平滑移动_使用transition与left属性
jvm·数据库·python
2301_8038756116 分钟前
C#怎么清空Dictionary字典_C#如何管理内存集合【基础】
jvm·数据库·python