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

相关推荐
iAm_Ike1 天前
Go 中自定义类型与基础类型间的显式类型转换详解
jvm·数据库·python
iuvtsrt1 天前
Golang怎么实现方法集与接口的匹配_Golang如何理解值类型和指针类型实现接口的区别【详解】
jvm·数据库·python
chao1898441 天前
基于 SPEA2 的多目标优化算法 MATLAB 实现
开发语言·算法·matlab
赏金术士1 天前
Kotlin 习题集 · 高级篇
android·开发语言·kotlin
tongluowan0071 天前
MySQL中列数量及长度
数据库·mysql
-liming-1 天前
单片机设计_串口调试工具
数据库·单片机·mongodb
楼兰公子1 天前
buildroot 在编译rust时裁剪平台类型数量的方法
开发语言·后端·rust
鹿角片ljp1 天前
从告警检测到智能研判:SQL 注入研判模型的设计与实践
数据库·sql
吴声子夜歌1 天前
Go——并发编程
开发语言·后端·golang
ooseabiscuit1 天前
Laravel4.x:现代PHP框架的奠基之作
java·开发语言·php