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

相关推荐
2301_8166602111 分钟前
CSS实现盒子倒角不规则效果_利用border-radius多个值
jvm·数据库·python
为什么要做囚徒12 分钟前
MongoDB 设置开机自启
数据库·mongodb
Johnstons12 分钟前
网络可观测性落地指南:从“出了问题才排查“到“实时感知全网状态“
开发语言·网络·php
李少兄12 分钟前
如何创建MySQL索引
数据库·mysql
2201_7610405913 分钟前
CSS如何根据父级容器宽度调整子项_利用容器查询container选择器css
jvm·数据库·python
uNke DEPH16 分钟前
Redis 安装及配置教程(Windows)【安装】
数据库·windows·redis
️是7818 分钟前
信息奥赛一本通—编程启蒙(3371:【例64.2】 生日相同)
开发语言·c++·算法
weixin_4585801219 分钟前
如何在 Python Fabric 中正确执行 EdgeOS 配置命令
jvm·数据库·python
Kiling_070420 分钟前
Java Math类核心用法全解析
java·开发语言
m0_7375393720 分钟前
mysql的理论和使用
数据库·mysql