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

相关推荐
酷ku的森几秒前
Redis中的Zset数据类型
数据库·redis·缓存
zhong liu bin2 分钟前
MySQL数据库面试题整理
数据结构·数据库·mysql
Aczone288 分钟前
硬件(六)arm指令
开发语言·汇编·arm开发·嵌入式硬件·算法
YA3331 小时前
java设计模式二、工厂
java·开发语言·设计模式
逐雨~1 小时前
9.8C++作业
开发语言·c++
我爱挣钱我也要早睡!2 小时前
Java 复习笔记
java·开发语言·笔记
Yang-Never3 小时前
Kotlin协程 -> Job.join() 完整流程图与核心源码分析
android·开发语言·kotlin·android studio
luckys.one5 小时前
第9篇:Freqtrade量化交易之config.json 基础入门与初始化
javascript·数据库·python·mysql·算法·json·区块链
ccut 第一混5 小时前
c# 调用basler 相机
c#·halcon·basler
TomCode先生5 小时前
c#动态树形表达式详解
开发语言·c#