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

相关推荐
月昤昽30 分钟前
autoCAD二次开发 4.正多边形与collection区分
算法·c#·二次开发·autocad二次开发
Victory_202540 分钟前
c#定时器顺序控制写法
开发语言·c#·c#顺序控制+定时器
Cyber4K1 小时前
【Python专项】Nginx访问日志分析时间范围处理示例
开发语言·python·nginx
PaperData1 小时前
1988-2025年《中国人口和就业统计年鉴》全年份excel+PDF
数据库·人工智能·数据分析·经管
中犇科技1 小时前
郑州无代码APP开发公司哪家好呢?推荐
开发语言
周末也要写八哥1 小时前
代码中的注释的重要性(二)
开发语言·python
星河耀银海2 小时前
C语言与数据库交互:SQLite实战与数据持久化
c语言·数据库·sqlite·交互
过期动态2 小时前
MySQL中的约束
android·java·数据库·spring boot·mysql
程序员陆通2 小时前
月烧 400 刀到不到 20 刀:我是怎么把 OpenClaw 的 Token 账单砍掉 95% 的
java·前端·数据库
Shan12052 小时前
站在计算机领域视角看:SQL注入攻击
网络·数据库·sql