这是写入部分的代码
void rtsp_video_stream_to_file(char ch, uint8_t* buf, uint32_t len, unsigned int pts)
{
if(get_file_record_info(ch)->h264Handle == NULL)
return;
if((buf[0] == 0x00) && (buf[1] == 0x00) && \
(buf[2] == 0x00) && (buf[3] == 0x01))
{
if((get_file_record_info(ch)->first_frame == 1) && buf[4] == 0x67)
{
COMM_SYSLOG(LOG_INFO, "############ch%d write avi first_frame##############\r\n", ch);
get_file_record_info(ch)->first_frame= 0;
}
if(get_file_record_info(ch)->first_frame == 0)
{
if(frame_data[ch].frame_buf_index > 0)
{
get_file_record_info(ch)->vframe_total_count ++;
pthread_mutex_lock(&get_file_record_info(ch)->mutex_h264_save);
if(get_file_record_info(ch)->h264Handle != NULL)
AVI_write_frame(get_file_record_info(ch)->h264Handle,buf, len, pts);
pthread_mutex_unlock(&get_file_record_info(ch)->mutex_h264_save);
}
frame_data[ch].frame_buf_index = 0;
}
else
{
frame_data[ch].frame_buf_index = 0;
return;
}
}
if(get_file_record_info(ch)->first_frame == 1)
{
frame_data[ch].frame_buf_index = 0;
return;
}
if(len > 0)
{
memcpy(&frame_data[ch].frame_buf[frame_data[ch].frame_buf_index], buf, len);
frame_data[ch].frame_buf_index+=len;
}
}
VLC提示无法解码格式“RV24” (24 bits RGB)
为题已解决,实为打开文件的时候没有设置视频文件的宽和高,AVI_set_video();