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

相关推荐
复园电子2 小时前
企业级PDF批量盖章方案选型指南
数据库·pdf
科技道人7 小时前
记录 默认置灰/禁用 app ‘Search Engine Selector‘ 的disable按钮
开发语言·前端·javascript
AI-好学者9 小时前
阶段一-图数据库基础与PropertyGraph模型
数据库·rag·knowledge graph·graphrag
逝水无殇10 小时前
C# 异常处理详解
开发语言·后端·c#
其实防守也摸鱼10 小时前
运维--学习阶段问题解答(1)(自测)
linux·运维·服务器·数据库·学习·自动化·命令模式
懒鸟一枚10 小时前
深入理解 Linux 内存、Swap 交换分区与分页机制的关系
java·linux·数据库
龙仔72510 小时前
SQL Server 创建只读账号完整操作(分两种场景:SSMS图形界面 + T-SQL脚本)
数据库·sql·oracle
霁月的小屋11 小时前
生产环境中的事务实践——银行系统上线记(四)
数据库
Database_Cool_11 小时前
AI 应用数据底座首选:阿里云 PolarDB 为大模型 RAG 提供一体化支撑
数据库·阿里云
玖玥拾11 小时前
C# 语言进阶(十五)C# 游戏服务端 MySQL 数据库
服务器·开发语言·网络·数据库·mysql·c#