Community
cancel
Showing results for 
Search instead for 
Did you mean: 
manca1
Beginner
99 Views

MP4 Muxer won't mux audio track (AAC)

Hi everyone,
I am having problems with the IPP MP4 Muxer. I'm trying to mux audio I'm getting from splitter (encoded) but it won't mux. It gives me invalid pointer error (becauseGET_INIT_BITSTREAM(&BS, lpData->GetDataPointer()); won't initialize BS structure in umc_mp4_mux.cpp). Downthere it breaks on line:
decSpecConfig.audioObjectType = get_audio_object_type_by_adts_header(&m_adts_fixed_header);
Probably because header is not initialized. My sample looks like this:
do
		{
			if (_MuxData.GetDataSize() < 4) 
			{
				do
				{ 
					status = _Splitter.GetNextData(&_MuxData,audioTrack);
					if (status == UMC::UMC_ERR_NOT_ENOUGH_DATA)
						 vm_time_sleep(5);
				} while(status==UMC::UMC_ERR_NOT_ENOUGH_DATA && !endOfAudio);
				if (((status != UMC::UMC_OK) && (status != UMC::UMC_ERR_END_OF_STREAM))|| (status == UMC::UMC_ERR_END_OF_STREAM)&& (_MuxData.GetDataSize() < 4))
					exit_flag = 1;
				
				if (!endOfAudio)
				{
					tmpData.Reset();
					tmpData.SetBufferPointer((Ipp8u*)_MuxData.GetBufferPointer(), _MuxData.GetDataSize());
					memcpy(tmpData.GetDataPointer(), _MuxData.GetDataPointer(), _MuxData.GetDataSize());
					tmpData.SetDataSize(_MuxData.GetDataSize());
					tmpData.SetTime(_MuxData.GetTime());
					status = _Muxer.PutAudioData(&tmpData);
				}
				
				if (status != UMC::UMC_OK)
				{
					_Muxer.PutEndOfStream(0);
					endOfAudio = true;
				}
				// reset input buffer
				memset(_MuxData.GetBufferPointer(),0,_MuxData.GetDataSize());
				_MuxData.SetDataSize(0);
			}
		} while(!exit_flag && (status == UMC::UMC_ERR_NOT_ENOUGH_DATA || status == UMC::UMC_ERR_SYNC));      
So, _Muxer.PutAudioData(&_MuxData) breaks on first call. I should mention that Muxing works perfectly well for VIDEO_TRACK, but it won't work for AUDIO and therefore it won't work when trying to mux them both in one stream.
The code for Video muxing is similar to this one. My video track is 0, and audio track is 1.
Please give me some hints if you have any. Maybe I am missing something. For the end, here's how I initialize Muxer:
_muxerParams.m_lpDataWriter = &_Writer;
	_muxerParams.m_SystemType = UMC::MP4_ATOM_STREAM;
	_muxerParams.m_nNumberOfTracks = 1;
	_muxerParams.pTrackParams = new UMC::TrackParams[_muxerParams.m_nNumberOfTracks];
	
//	videoInfo = (UMC::VideoStreamInfo*)(streamInfo->m_ppTrackInfo[videoTrack]->m_pStreamInfo);
	audioInfo = (UMC::AudioStreamInfo*)(streamInfo->m_ppTrackInfo[audioTrack]->m_pStreamInfo);

	//_muxerParams.pTrackParams[0].type = UMC::VIDEO_TRACK;
	//_muxerParams.pTrackParams[0].info.video = videoInfo;
	//_muxerParams.pTrackParams[0].bufferParams.m_prefInputBufferSize = 2000000;
	//_muxerParams.pTrackParams[0].bufferParams.m_prefOutputBufferSize = 2000000;

	_muxerParams.pTrackParams[0].type = UMC::AUDIO_TRACK;
	_muxerParams.pTrackParams[0].info.audio = audioInfo;
	_muxerParams.pTrackParams[0].bufferParams.m_prefInputBufferSize = 1000;
	_muxerParams.pTrackParams[0].bufferParams.m_prefOutputBufferSize = 1000;
Thanks a lot in advance.
Regards,
Manca
0 Kudos
3 Replies
manca1
Beginner
97 Views

Hi, I figured out why the audio data wouldn't mux. I neededFLAG_DATA_FROM_SPLITTER as one of Muxer parameters. But now, even though the audio is correctly muxed, it won't play when opened with VLC or mplayer. Mplayer shows these errors:
FAAD: Failed to decode frame: Scalefactor out of range
FAAD: Failed to decode frame: Input data buffer too small
AO: [pulse] 64000Hz 2ch s16le (2 bytes per sample)
Starting playback...
FAAD: Failed to decode frame: Gain control not yet implemented
FAAD: Failed to decode frame: Gain control not yet implemented
FAAD: Failed to decode frame: Maximum number of bitstream elements exceeded
FAAD: Failed to decode frame: Maximum number of bitstream elements exceeded
FAAD: Failed to decode frame: Maximum number of bitstream elements exceeded
FAAD: Failed to decode frame: Scalefactor out of range
FAAD: Failed to decode frame: Scalefactor out of range
FAAD: Failed to decode frame: Scalefactor out of rangeFAAD: Failed to decode frame: Input data buffer too smallAO: [pulse] 64000Hz 2ch s16le (2 bytes per sample)Starting playback...FAAD: Failed to decode frame: Gain control not yet implementedFAAD: Failed to decode frame: Gain control not yet implementedFAAD: Failed to decode frame: Maximum number of bitstream elements exceededFAAD: Failed to decode frame: Maximum number of bitstream elements exceededFAAD: Failed to decode frame: Maximum number of bitstream elements exceededFAAD: Failed to decode frame: Scalefactor out of rangeFAAD: Failed to decode frame: Scalefactor out of range
Do you have some ideas what else do I need in order to make this muxer work?
Thanks a lot!

Manca
manca1
Beginner
97 Views

Hello,
I still don't know why the audio tracks can't be decoded when tried to play muxed with video (or muxed alone in stream as well). VLC says that it can't decode mp4a (AAC audio). Everything looks like I am missing some flag or muxing it on a wrong way? I handle end of stream correctly and always put for both audio and video end of stream once it's found.
Please help.
Thanks
manca1
Beginner
97 Views

anyone? Intel guys?
Reply