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

相关推荐
java1234_小锋几秒前
一周学会Flask3 Python Web开发-flask3模块化blueprint配置
开发语言·python·flask·flask3
听封4 分钟前
✨ 索引有哪些缺点以及具体有哪些索引类型
数据库·mysql
利瑞华9 分钟前
数据库索引:缺点与类型全解析
数据库·oracle
V+zmm1013412 分钟前
自驾游拼团小程序的设计与实现(ssm论文源码调试讲解)
java·数据库·微信小程序·小程序·毕业设计
ChinaRainbowSea24 分钟前
1. Linux下 MySQL 的详细安装与使用
linux·数据库·sql·mysql·adb
我是苏苏25 分钟前
C#基础:使用Linq进行简单去重处理(DinstinctBy/反射)
开发语言·c#·linq
小小码农(找工作版)27 分钟前
C#前端开发面试题
开发语言·c#
不爱学英文的码字机器34 分钟前
Python爬虫实战:从零到一构建数据采集系统
开发语言·爬虫·python
我是哈哈hh35 分钟前
【JavaScript进阶】作用域&解构&箭头函数
开发语言·前端·javascript·html
鹿鸣悠悠40 分钟前
Python 类和对象详解
开发语言·python