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

相关推荐
黄贵根5 小时前
JavaScript实现教培行业意向登记系统
开发语言·javascript·ecmascript
zzzll11118 小时前
Claude Code离线安装方案揭秘
开发语言·php
神王宝宝 王者小学8 小时前
HBase: 看上去很美
大数据·数据库·hbase
io无心9 小时前
Shardingsphere5分库分表
数据库·mysql
wling03019 小时前
vasp虚频计算-python脚本
开发语言·windows·python·vasp计算
wWYy.9 小时前
Mysql:主键索引 唯一索引 普通索引 前缀索引
数据库·mysql
郝学胜-神的一滴9 小时前
Qt 高级编程 040:按钮悬浮弹出滑块弹窗的完整攻略
开发语言·c++·qt·软件工程·用户界面
宝杰X79 小时前
Android Room3 多平台数据库
android·数据库
xrandzj10 小时前
Python面向对象编程入门:类、实例、初始化与封装实践
开发语言·python
DLYSB_11 小时前
API 网关流量洪峰与突发 CC 攻击:我用 Go 写了个“现场物理防御哨兵”,把故障响应压缩到秒级
开发语言·后端·golang·报警灯