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

相关推荐
LOVE️YOU29 分钟前
Python 中 Tuple 为什么有时可 Hash,有时不可 Hash?
开发语言·python·哈希算法
李永奉42 分钟前
C语言-指针函数与函数指针及回调函数的使用
c语言·开发语言
小oo呆42 分钟前
【学习心得】迭代器和可迭代对象
开发语言·python
gb42152871 小时前
向量数据库多模态特性
数据库
AC赳赳老秦1 小时前
采集行为合规自检:OpenClaw 自动校验 robots 协议与采集频率,规避违规采集风险
java·开发语言·c++·python·php·deepseek·openclaw
钱栈up1 小时前
mvn compile 卡死在 javac 阶段:一次类型不匹配的排查与修复
java·开发语言
迅猛龙办公室1 小时前
Python输出当前计算机的系统日期和时间
开发语言·前端·python
泡海椒1 小时前
数据占比展示:jquick-pdf饼图动态数据渲染PDF教程
数据库·oracle·pdf
杨丰玮4181 小时前
C语言基础知识(一)————各类符号的含义与输入输出库(stdio)
c语言·开发语言
大连好光景1 小时前
向量数据库的工作流程详解
数据库·milvus