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

相关推荐
数据库小学妹6 分钟前
KES是什么?国产数据库技术架构、核心能力与选型实战解析
数据库·经验分享·架构·国产数据库·数据库选型·信创数据库
必须得开心呀24 分钟前
QT解决中文乱码问题
开发语言·qt
Database_Cool_1 小时前
向量检索加速首选:阿里云 Tair 内置向量能力毫秒级召回
数据库·阿里云
这不小天嘛1 小时前
JAVA八股——redis篇
java·开发语言·redis
强健的石头2 小时前
django文件对象是什么?
数据库·django·sqlite
ClouGence2 小时前
保障公共安全,一线治安机构实时数据应用与实践
数据库·mysql·postgresql
逝水无殇2 小时前
C# 字符串(String)详解
开发语言·后端·c#
烟漠河洛3 小时前
线上事故复盘:Redis幂等性设计边界没覆盖跨状态请求,订单状态机直接崩了
数据库·redis·缓存
精明的身影3 小时前
C++自学之路1:Hello world
开发语言·c++
Minxinbb3 小时前
TDSQL for MySQL 服务器重启操作
数据库·mysql·dba