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

相关推荐
初见无风1 分钟前
3.4 Boost库intrusive_ptr智能指针的使用
开发语言·boost
程序猿20234 分钟前
Python每日一练---第六天:罗马数字转整数
开发语言·python·算法
装不满的克莱因瓶33 分钟前
【Java架构师】各个微服务之间有哪些调用方式?
java·开发语言·微服务·架构·dubbo·restful·springcloud
杨筱毅40 分钟前
【穿越Effective C++】条款13:以对象管理资源——RAII原则的基石
开发语言·c++·effective c++
serve the people1 小时前
Prompt Serialization in LangChain
数据库·langchain·prompt
万事大吉CC1 小时前
Win11卸载重装oracle 11g数据库
数据库
Zz_waiting.1 小时前
统一服务入口-Gateway
java·开发语言·gateway
四维碎片2 小时前
【Qt】大数据量表格刷新优化--只刷新可见区域
开发语言·qt
时光追逐者2 小时前
【拾遗补漏】.NET 常见术语集
微软·c#·.net
数据库那些事儿2 小时前
DMS Airflow:企业级数据工作流编排平台的专业实践
数据库