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

相关推荐
动词ing11 分钟前
【C语言】结构体+文件基础
c语言·开发语言·数据结构
淡海水21 分钟前
02-06-历史-托管GC机制-垃圾回收如何影响数据结构选择
c#·编译·gc·机器码
caimouse27 分钟前
ReactOS 窗口系统分析(7):分层窗口与绘制辅助 — layered.c + draw.c
c语言·开发语言
保卫大狮兄34 分钟前
设备管理从台账到报废,完整生命周期一次讲清
数据库·设备管理·设备
丰锋ff1 小时前
基于 Qt 的智慧社区物业管理系统
开发语言·qt
数据安全技术观察1 小时前
数据动态脱敏:让脱敏策略跟着数据目录走
大数据·网络·数据库
夜不会漫长1 小时前
C++入门(1)
开发语言·c++·算法
大鹏说大话1 小时前
从爬虫到决策引擎:大数据下自媒体如何用Python挖掘用户痛点
开发语言·爬虫·python
Niuguangshuo1 小时前
silero-vad:超轻量级开源 VAD 实践指南
开发语言·python
小席是个热心肠2 小时前
Redis的自我学习
数据库·redis·学习