Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
6th December 2013, 15:11 | #1 | Link |
Registered User
Join Date: Sep 2007
Posts: 50
|
muxing h.264 and aac in MP4
Hi,
Is there a way (library, framework, source code etc...) to multiplex H.264 and AAC in a MP4 file format on a frame by frame and audio chunk by audio chunk basis? There are tons of libraries but they are all file based. Thanks, malikcis |
6th December 2013, 16:08 | #3 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
What about those?
* https://github.com/silverfilain/L-SMASH * http://sourceforge.net/projects/gpac/ For usage example, see here: http://git.videolan.org/?p=x264.git;...t/mp4_lsmash.c
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 6th December 2013 at 16:14. |
6th December 2013, 16:16 | #4 | Link |
Registered User
Join Date: Sep 2007
Posts: 50
|
The basic idea is to mux an audio/video stream as follows:
initialize_mp4_muxer("file.mp4"); initialize_hw_framegrabber(); while(1) { get_h264_frame(pVidBuffer); get_aac_audio_chunk(pAudChunk); mp4_mux(pVidBuffer, pAudChunk); } close_all_resources(); |
6th December 2013, 16:33 | #5 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Did you check out the above links?
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ |
7th December 2013, 13:57 | #7 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
Obviously, you would need to setup two tracks rather than a single one (cf. set_param() method) and then append the audio and video samples to the audio and video track, respectively (cf. write_frame() method).
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ |
|
7th December 2013, 21:50 | #8 | Link | |
Spinner of yarns
Join Date: May 2009
Posts: 164
|
Quote:
About muxing both audio and video, x264_L-SMASH may be helpful, though it's somewhat old. https://github.com/silverfilain/x264...h/output/mp4.c x264_L-SMASH writes audio frames for each write_frame(). The code is asymmetry. L-SMASH muxes chunk by chunk internally from input frames unless exceeding max_async_tolerance. You can append video frames and audio frames in arbitrary timing as L-SMASH muxer app does. http://repo.or.cz/w/L-SMASH.git/blob/HEAD:/muxer.c#l976 If you want to interleave each video frame and each audio chunk, set duration of video frame to max_chunk_duration.
__________________
僕と契約して、L-SMASH developerになってよ! L-SMASH | L-SMASH Works | Opus-in-ISOBMFF specification and reference software Last edited by VFR maniac; 7th December 2013 at 22:24. Reason: typo |
|
9th December 2013, 18:23 | #9 | Link | |
Registered User
Join Date: Sep 2007
Posts: 50
|
Quote:
Thank you, This indeed seems to be a possible way. The hard part (implementation) remains though... |
|
|
|