【已解决】tuya 4.9.8实现本地MP4录像,录像回放时没有声音

IPC/NVR/可视门铃等具备多媒体能力的设备,扫地机/AGV等机器人设备


Post Reply
onecam
Posts: 1

问题描述:当前基于tuya 4.9.8 SDK 实现了MP4本地存储,录像检索,视频回放功能均正常, 但是回放时,没有声音,录像时
录像存储时,AAC编码如下
int ret;

Code: Select all

ret = aacEncOpen(&thiz->handle, 0, thiz->channels);
if(ret != 0){
	printf("[%s][%s] aac enc open failed\n", TAG, __func__);
	return -1;
}

ret = aacEncoder_SetParam(thiz->handle, AACENC_AOT, 2);
if(ret != AACENC_OK){
	printf("[%s][%s] aac encoder set param\n", TAG, __func__);
	return -1;
}	

ret = aacEncoder_SetParam(thiz->handle, AACENC_SAMPLERATE, 8000);
if(ret != 0){
	printf("[%s][%s] aac encoder set AACENC_SAMPLERATE param failed\n", TAG, __func__);
	return -1;
}

ret = aacEncoder_SetParam(thiz->handle, AACENC_CHANNELMODE, MODE_1);
if(ret != 0){
	printf("[%s][%s] aac encoder set AACENC_CHANNELMODE param failed\n", TAG, __func__);
	return -1;
}	

ret = aacEncoder_SetParam(thiz->handle, AACENC_TRANSMUX, 6);
if(ret != 0){
	printf("[%s][%s] aac encoder set AACENC_TRANSMUX param failed\n", TAG, __func__);
	return -1;
}

回放时发送音频转换如下
STATIC VOID __TUYA_APP_mp4_media_frame_TO_trans_audio(IN CONST MEDIA_FRAME_S *p_in, INOUT TRANSFER_AUDIO_FRAME_S *p_out)
{
p_out->audio_codec = TUYA_CODEC_AUDIO_AAC_LATM;
p_out->audio_sample = s_media_info.audio_sample[E_CHANNEL_AUDIO];
p_out->audio_databits = s_media_info.audio_databits[E_CHANNEL_AUDIO];
p_out->audio_channel = s_media_info.audio_channel[E_CHANNEL_AUDIO];
p_out->p_audio_buf = p_in->p_buf;
p_out->buf_len = p_in->size;
p_out->pts = p_in->pts;
p_out->timestamp = p_in->timestamp;
}


Tags:
User avatar
pippin-bobo
Posts: 236

Re: tuya 4.9.8实现本地MP4录像,录像回放时没有声音

APP不支持AAC音频播放,建议使用其他格式

Post Reply