前言
注意:flv是不支持h.265封装的。目前解封装功能正常,所得到的H.264文件与AAC文件均可正常播放。
$ make clean && make DEBUG=1
$
$ $ ./flv_demux_h264_aac
Usage:
./flv_demux_h264_aac avfile/test1.flv
./flv_demux_h264_aac avfile/test2.flv
【参考文章】
【参考源码】
【工具下载】
SpecialAAAC.exe:https://sourceforge.net/projects/aacstreamanalysis/
H264BSAnalyzer.exe:https://github.com/latelee/H264BSAnalyzer/tree/master/release
FlvParse.exe:https://github.com/ty6815/AvStackDocs/tree/master/media%20format/flv
$ tree
.
├── aac_adts.c
├── aac_adts.h
├── avfile
│ ├── test1.aac
│ ├── test1.flv
│ ├── test1.h264
│ ├── test2.aac
│ ├── test2.flv
│ └── test2.h264
├── docs
│ ├── FLV封装格式介绍及解析 - 简书.mhtml
│ ├── FLV格式详解_JT同学的博客-CSDN博客_flv格式.mhtml
│ ├── 笔记---H.264里的SEI - 简书.mhtml
│ ├── 音视频封装:FLV格式详解和打包H264、AAC方案(上) - 云+社区 - 腾讯云.mhtml
│ └── 音视频封装:FLV格式详解和打包H264、AAC方案(下) - 云+社区 - 腾讯云.mhtml
├── flv.c
├── flv_format.h
├── flv.h
├── h264_nalu.h
├── main.c
├── Makefile
├── README.md
├── reference_code
│ └── Flv_to_h264_AAC_Demux.zip
└── tools
├── FlvParse.exe
├── H264BSAnalyzer.exe
└── SpecialAAAC.exe
/***************************************************************
* describe: Flv file format description(Mainly for H.264 & AAC)
* author: linriming
* e-mail: linriming20@163.com
***************************************************************/
#ifndef __FLV_FORMAT_H__
#define __FLV_FORMAT_H__
#include
#define AUDIO_SUPPORT(x) (x << 2) /* bit[2] in flvheader's type_flag */
#define VIDEO_SUPPORT(x) (x << 0) /* bit[0] in flvheader's type_flag */
#define SIZE_FLV_HEADER sizeof(struct flvHeader) /* 9 Bytes */
#define SIZE_FLV_TAG_HEADER sizeof(struct flvTagHeader) /* 11 Bytes */
#define SIZE_PREVIOUS_TAG_SIZE sizeof(uint32_t) /* 4 Bytes */
/* FLV tag type */
typedef enum{
FLVTAG_TYPE_AUDIO = 0x08,
FLVTAG_TYPE_VIDEO = 0x09,
FLVTAG_TYPE_SCRIPT = 0x12,
}flvTagType;
/* AMF data type in