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

相关推荐
aaaameliaaa8 分钟前
计算斐波那契数(递归、迭代)(1,1,2,3,5.....)
c语言·开发语言·笔记·算法·排序算法
m0_5474866614 分钟前
《模式识别:使用MATLAB分析与实现》全套PPT课件
开发语言·matlab·模式识别
Tim_1014 分钟前
【C++】009、extern关键字
java·开发语言
尽兴-27 分钟前
Redis 为什么快?
数据库·redis·内存
林澈在路上29 分钟前
最新版权清晰 AI音乐写歌工具软件App推荐 商用全场景实测指南
数据库·人工智能·ai·aigc·音频
Full Stack Developme1 小时前
正则表达式的使用教程
java·数据库·正则表达式
大郭鹏宇1 小时前
MongoDB快速实战与基本原理入门
数据库·mongodb
KASH_SHADOW1 小时前
8-Mysql的安装与配置
数据库·mysql·adb
zhiSiBuYu05171 小时前
重排序(Rerank)提升检索准确率实战指南
开发语言·python·算法