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

相关推荐
_extraordinary_31 分钟前
Java Spring配置
java·开发语言·spring
wayuncn43 分钟前
哈尔滨电商企业服务器托管方案
运维·服务器·数据库
进击的大海贼1 小时前
QT-C++ 自定义加工统计通用模块
开发语言·c++·qt
Rhys..1 小时前
JS - npm init
开发语言·javascript·npm
c#上位机1 小时前
wpf之命令
c#·wpf
newxtc1 小时前
【 广州产权交易所-注册安全分析报告-无验证方式导致安全隐患】
开发语言·人工智能·selenium·安全·yolo
兩尛1 小时前
java八股-操作系统
java·开发语言
重整旗鼓~1 小时前
27.Redisson基本使用和可重入性
数据库·redis·缓存
wjs20241 小时前
SQL 日期处理指南
开发语言
瑶总迷弟1 小时前
使用 Docker 和 docker-compose 快速部署 openGauss
linux·数据库·云原生·eureka