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

相关推荐
m0_380743877 小时前
PHP 8.3 接口返回数据为空怎么排查
开发语言·php
曹牧7 小时前
PL/SQL Developer:导出建表语句
数据库·sql
念念不忘 必有回响7 小时前
MySQL 事务与隔离级别完全指南
数据库·mysql
谢亮_vipxieliang7 小时前
Java 21 新特性实战:Record、Sealed、模式匹配
java·开发语言
霸道流氓气质8 小时前
LLM 应用限流与熔断机制完全指南:从多层防护架构到Java生产级弹性实战
java·开发语言·架构
大侠归来8 小时前
C语言内存管理:从栈到堆的完整指南
c语言·开发语言·python
m0_380743878 小时前
PHP7.0字符串在Docker怎么用
开发语言·php
JosieBook8 小时前
【WinForm 代码反脆弱系列】04 数据库操作 —— 连接字符串、连接对象与连接池
数据库·oracle
小蒜学长8 小时前
基于SpringBoot+Vue的小学数学智能出题系统(代码+数据库+LW)
java·数据库·spring boot·后端·智能出题系统
71-38 小时前
MySQL密码重置
数据库·笔记·学习·mysql