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

相关推荐
wearegogog123几秒前
C# .NET 文件比较工具 WinForms
开发语言·c#·.net
再写一行代码就下班4 分钟前
Cursor配置Java环境、创建Spring Boot项目的步骤
java·开发语言·spring boot
零陵上将军_xdr7 分钟前
后端转全栈学习-Day5-JavaScript 基础-3
开发语言·javascript·学习
oqX0Cazj217 分钟前
2026超火Go-Zero实战:从架构原理到高并发接口落地,彻底解决接口超时、雪崩问题
开发语言·架构·golang
学会去珍惜21 分钟前
C语言简介
c语言·开发语言
糖不吃21 分钟前
WPF值转换器
c#
思麟呀24 分钟前
C++11 核心特性(三):强类型枚举、static_assert 与 std::tuple
开发语言·c++
hoiii18730 分钟前
Qt 实现屏幕截图功能
开发语言·qt·命令模式
摇滚侠36 分钟前
Spring 零基础入门到进阶 基于 XML 管理 Bean 14-28
xml·数据库·spring
小白学大数据1 小时前
爬虫性能天花板:asyncio赋能 Aiohttp,并发提速 10 倍
开发语言·爬虫·数据分析