FFMPEG (ii)-Universal multiplexer
One: Technical points
As mentioned in the previous article, the reuse structure of the MP4 type differs from other types, such as mp4,mov,flv, where the H264 data does not contain descriptive information such as SPS,PPS, to reduce overhead,
The same is true for AAC data, which requires converting the previous 7-byte Adts header to a two-byte frame length.
FFmpeg provides something called the filter filters to do this. For this, some filter is listed below to implement some conversion functions, the function can see the name
H264_mp4toannexb
Mp3decomp
Mp3comp
Mov2textsub
Mjpegadump
Mjpeg2jpeg
Imxdump
Dump_extra
Aac_adtstoasc
This paper mainly uses AAC_ADTSTOASC this filter to complete the relevant MUX function
Second: there are problems
Above will have the problem of the place enumerated, this demo exists problem is av_read_frame read out of the packet inside Pts,dts if really do audio and video synchronization, you need to fill in, I temporarily did not find a better method, this demo can basically achieve audio and video synchronization, But a long time will appear some error, if there is an expert, can be three kinds of synchronization methods common, hope to communicate:
1: Sync audio to video
2: Sync video to Audio
3: Synchronize both to the external clock
Exchange Please add qq:379969650
Demo Address: http://download.csdn.net/detail/zhuweigangzwg/5343063