When using the FFMPEG class library for programming, you can directly output the audio data stream after the multiplexing. You only need to save the AVPacket of the video as a local file after av_read_frame () is called each time.
After testing, AVPacket can be directly stored when the MP3 code stream is separated.
When the AAC code stream is separated, files directly stored in AVPacket may not be played.
If the format of video and audio multiplexing is TSMPEG2TransportStream, the directly stored files can be played.
If the format for reuse is FLV or MP4, it cannot be used.
Because FLV and MP4 belong to "special containers ". After careful comparison, we found that the AVPacket obtained after av_read_frame () is pure AAC data, which is the AAC data that does not contain the ADTS file header. Therefore, if you want to obtain an AAC file that can be played, you need to add a 7-byte ADTS File Header before each AVPacket. I have not carefully studied the specific format of the ADTS file header, so I will be studying it later.
This article is from the "leixiao00001020 audio and video technology" blog, please be sure to keep this source http://leixiaohua1020.blog.51cto.com/3974648/1303851