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

相关推荐
Fuyo_11191 分钟前
C++中的活字印刷术——模板·初阶
开发语言·c++·笔记
在角落发呆2 分钟前
跨越网络鸿沟:传统文件传输与现代内网穿透的奇妙交响
开发语言·php
Season4506 分钟前
C++之模板元编程(前置知识 constexpr)
开发语言·c++
坚定信念,勇往无前7 分钟前
electron-vite 安装better-sqlite3
javascript·数据库·electron
AI玫瑰助手8 分钟前
Python运算符:比较运算符(等于不等等于大于小于)与返回值
android·开发语言·python
大明者省12 分钟前
Ubuntu22.04 宝塔面板与 XFCE 远程桌面端口兼容性分析
运维·服务器·数据库·笔记
月巴月巴白勺合鸟月半19 分钟前
使用RAG完成一个基于本地的知识库的问答
c#
计算机安禾31 分钟前
【c++面向对象编程】第40篇:单例模式(Singleton)的多种C++实现
开发语言·c++·单例模式
liudanzhengxi37 分钟前
巧用ULN2003A轻松扩展单片机IO口
数据库·mongodb