问题
I'm doing some integration work with video (H.264) and audio (AAC) from an IP camera.
I've made a bit of progress and I can store the video & audio streams individually with the ability to play it back using VLC player. The H.264 is being stored in Annex B format and the audio is using an adts formatted file.
I'm now trying to mux the streams into an MP4 file without doing any decoding or encoding but so far haven't managed to find the answer.
I can do this manually with ffmpeg: ffmpeg -i recording.h264 -i recording.aac -vcodec copy -acodec copy -absf aac_adtstoasc recording.mp4
How do I do this with the ffmpeg library from C++?
回答1:
Check out the muxing sample; the key is to keep track of your audio/video timestamps and write the next one in time using av_interleaved_write_frame
.
来源:https://stackoverflow.com/questions/15239124/muxing-a-h-264-annex-b-aac-stream-using-libavformat-with-vcopy-acopy