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

相关推荐
kyrie_sakura几秒前
MySQL数据库学习笔记3--关联(联合)查询
数据库·学习·mysql
子非鱼a7 分钟前
【WEB】[RoarCTF 2019]Easy Java
java·开发语言
软件黑马王子12 分钟前
19.资源加载模块:主要作用和基本原理
开发语言·前端框架·c#
陈皮波比茶26 分钟前
计算机二级MySQL笔记
java·数据库
行业研究员29 分钟前
腾讯云数据库 PostgreSQL 让相关子查询跑上多核
数据库·postgresql·腾讯云
zzzll111130 分钟前
LangChain 1.3 新特性详解与实战指南
java·数据库·langchain
石小千31 分钟前
MySQL 8.4设置密码策略
数据库·mysql
fengkai454536 分钟前
七、华为云网络类 + 计算类云服务实验总结
开发语言·php
神明不懂浪漫39 分钟前
【第四章】索引——B+树、回表,加快数据库的查找能力的利器
开发语言·数据结构·数据库·经验分享·笔记·b树