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

相关推荐
CUMT_DJ21 小时前
matlab计算算法的运行时间
开发语言·算法·matlab
W.Buffer21 小时前
通用:MySQL-深入理解MySQL中的MVCC:原理、实现与实战价值
数据库·mysql
一只小bit1 天前
MySQL 库的操作:从创建配置到备份恢复
服务器·数据库·mysql·oracle
sanx181 天前
专业电竞体育数据与系统解决方案
前端·数据库·apache·数据库开发·时序数据库
张人玉1 天前
C# TCP 客户端开发笔记(TcpClient)
笔记·tcp/ip·c#
Overboom1 天前
[C++] --- 常用设计模式
开发语言·c++·设计模式
Univin1 天前
C++(10.4)
开发语言·数据结构·c++
KyollBM1 天前
每日羊题 (质数筛 + 数学 | 构造 + 位运算)
开发语言·c++·算法
养生技术人1 天前
Oracle OCP认证考试题目详解082系列第57题
运维·数据库·sql·oracle·开闭原则
不良人天码星1 天前
redis-zset数据类型的常见指令(sorted set)
数据库·redis·缓存