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

相关推荐
布莱克6057 分钟前
Swift 字符串详解:从基础用法到性能与最佳实践
服务器·开发语言·ssh·字符串·swift
nice_lcj5201 小时前
MySQL 慢查询与 EXPLAIN:怎么定位、怎么优化
java·数据库·后端·mysql
饿了吃洗衣凝珠1 小时前
SELinux
服务器·开发语言·php
蜗牛一步步往上爬1 小时前
第四章 更多的bash shell命令
linux·开发语言·bash
普通人62 小时前
PHP多维数组排序完全指南
开发语言·php·1024程序员节
OceanRoy11 小时前
数据库表的设计
数据库·内连接·外连接·er图·表的约束·三大范式·多表连接
starzy199012 小时前
深入理解Scala隐式类:扩展方法机制
开发语言·人工智能·scala
Pniubi12 小时前
怎么排查慢SQL,怎么解决?
java·数据库·sql
M--Y12 小时前
LangGraph 工作流模式
开发语言·javascript·python·langchain·大模型·llm·langgraph
吴可可12314 小时前
WScript Shell操作注册表详解
开发语言