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

相关推荐
烟烟Abandon1 小时前
FFmpeg开发基础之 C 语言 :再论指针(讲透指针)
c语言·开发语言·ffmpeg
程序猿追4 小时前
换场倒计时的暂停、重置与到点回调在 HarmonyOS 7 上怎么处理
运维·服务器·数据库·harmonyos
阿俊-全栈开发4 小时前
扩展设计解析:LikeShop Go 版商城营销活动的插件化扩展设计思路
开发语言·微服务·golang·likeshop·likeshop源码
干啥啥不行,bug第一名4 小时前
EAFNOSUPPORT、EPROTOTYPE、EOPNOTSUPP:socket 的三层参数没有对齐
开发语言·php
我要见SA姐15 小时前
用生活化类比当钥匙,一键打开 C++ 入门大门
java·开发语言·c++
@forever@5 小时前
【MySQL】数据库基础、架构与存储引擎详解
数据库·mysql·架构
1024奇点5 小时前
第四篇 第 03 课
开发语言·ide·后端
大彼方..6 小时前
CSDN-02-开发环境介绍与安装
c语言·开发语言·stm32
轩轩曲觞阁6 小时前
MySQL基础——数据类型
数据库·mysql
jnrjian6 小时前
Oracle 19C LogMiner 分析 Supplemental Log Groups
数据库·oracle