Use the FFMPEG class library to separate audio streams in multimedia files

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.