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

相关推荐
BUG研究员_12 小时前
Runnable与LCEL
开发语言·人工智能·python
范什么特西12 小时前
回答知识总结04(redis)
数据库·redis·缓存
码农颜13 小时前
5.4.1 锁分类
java·数据库·mysql
云深处@14 小时前
【数据库】MySQL 入门
数据库·学习·mysql
梦远星帆14 小时前
SQLyog社区版下载
数据库·mysql·sqlyog
牛艺翔14 小时前
C++基础
开发语言·c++
键盘会跳舞14 小时前
C++ :容器适配器stack源码级拆解
开发语言·c++··stack·先进后出
美味蛋炒饭.14 小时前
Git 版本控制(下)
开发语言·git·学习·总结·后端开发
yanaiding15 小时前
C# WPF 独立开发看图工具 PixSight 经验介绍(二)—— 水印模块开发实录
图像处理·c#·wpf·个人开发
我星期八休息15 小时前
网络编程—网络层
开发语言·前端·网络·人工智能·智能路由器