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

相关推荐
夕除1 小时前
shizhan--10
java·开发语言
Zhang~Ling1 小时前
C++ 红黑树封装:myset和mymap的底层实现
开发语言·数据结构·c++·算法
ECT-OS-JiuHuaShan1 小时前
什么是对和错?——“有针对性定义域的逻辑值的真伪”:认识论终极追问的公理化裁决
数据库·人工智能·算法·机器学习·数学建模
原来是猿1 小时前
为什么 C++ 需要区分左值和右值?
开发语言·c++
乐维_lwops1 小时前
多类型数据库如何高效监控?
数据库·数据库监控·运维监控
xier_ran1 小时前
【infra之路】PagedAttention
java·开发语言
齐潇宇1 小时前
Redis数据库基础
linux·数据库·redis·缓存
SilentSamsara1 小时前
NumPy 进阶:广播机制、ufunc 与向量化计算的工程实践
开发语言·python·青少年编程·性能优化·numpy
珊瑚里的鱼1 小时前
C++的强制类型转换
android·开发语言·c++
三更两点1 小时前
AI拉呱-技术洞察 - 2026-06-01
数据库·人工智能·技术洞察