C#通过文件头判断flv文件

目录

效果

代码


效果

代码

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);

}

复制代码
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

相关推荐
学困昇15 小时前
C++11中的{}与std::initializer_list
开发语言·c++·c++11
郝学胜-神的一滴15 小时前
Qt的QComboBox控件详解:从API到样式定制
开发语言·c++·qt·程序人生·个人开发
憧憬blog15 小时前
【Kiro开发集训营】拒绝“屎山”堆积:在 Kiro 中重构“需求-代码”的血缘关系
java·开发语言·kiro
青春:一叶知秋15 小时前
【Redis存储】List列表
数据库·redis·缓存
n***i9516 小时前
Java NIO文件操作
java·开发语言·nio
星释16 小时前
Rust 练习册 72:多米诺骨牌与回溯算法
开发语言·算法·rust
爆更小哇17 小时前
MyBatis的TypeHandler :优雅地实现数据加密与解密
数据库·后端·mybatis
likuolei17 小时前
Eclipse 创建 Java 接口
java·数据库·eclipse
w***153117 小时前
Spring boot启动原理及相关组件
数据库·spring boot·后端