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

相关推荐
寻星探路2 分钟前
【算法专题】滑动窗口:从“无重复字符”到“字母异位词”的深度剖析
java·开发语言·c++·人工智能·python·算法·ai
程序员小白条2 分钟前
面试 Java 基础八股文十问十答第八期
java·开发语言·数据库·spring·面试·职场和发展·毕设
Dxy12393102163 分钟前
python连接minio报错:‘SSL routines‘, ‘ssl3_get_record‘, ‘wrong version number‘
开发语言·python·ssl
大王小生7 分钟前
C# CancellationToken
开发语言·c#·token·cancellation
listhi5208 分钟前
基于C#实现屏幕放大镜功能
开发语言·c#
汗流浃背了吧,老弟!29 分钟前
向量数据库在RAG中的非必需场景及替代方案
数据库
brevity_souls32 分钟前
SQL 中 BETWEEN 和 IN 的区别
数据库·sql
我叫袁小陌33 分钟前
C++多线程全面详解
开发语言·c++
lihongli00044 分钟前
【工程实战】Win11 + Ubuntu20.04 + Ubuntu24.04 三系统长期稳定安装方案(含避坑指南)
开发语言
黄宝康1 小时前
sublimetext 运行python程序
开发语言·python