4037
- 收藏
- 点赞
- 分享
- 举报
hisi 3518a 视频丢失
本帖最后由 duxd1989 于 2014-8-28 17:02 编辑
SD卡存贮过程中 约定好256M 打包一段视频 现在两段视频之间会又1s中左右的视频丢失 有时候也没有 不知道是什么原因
[code]while( AbortSignal == 0 )
{
if(cWriteNextFile)
{
int iRet = 0;
videoLasttime = -1;
syncIframe = 0;
lastCnt = -1;
audioLasttime = -1;
LastCnt = -1;
basetime = 0;
Audio_Serial_Start = -1;
Video_Serial_Start = 0;
audio_frame_count=0;
video_frame_count=0;
if(nIsChkcard == 1)
{
#ifdef CIRCULAR_REC_ENABLE
memset(cFilename, 0, sizeof(cFilename));
AV_GetCurrentFileName(cFilename);
GetvalidFilename(filename);
filelimit = GetFilelimitSize(filename);
printf("[main] filename = %s, filelimit = %ld", filename, (long)filelimit);
#else
if(IsLimit_Reach == 2)
{
printf("\n[AVI_SAVE]Space is not enough,Exit\n");
IsLimit_Reach = 0;
return 99;
}
#endif
}else{
if(IsLimit_Reach == 2)
{
printf("\n[AVI_SAVE]Space is not enough,Exit\n");
IsLimit_Reach = 0;
return 99;
}
}
av_reset_stream(video_st);
av_reset_stream(audio_st);
/* now that all the parameters are set, we can open the audio and
video codecs and allocate the necessary encode buffers */
if (video_st)
open_video(oc, video_st);
if (audio_st)
open_audio(oc, audio_st);
if(nIsChkcard == 1)
AV_Open_File(fmt, oc, filename);
else
iRet = AV_Save_WriteSerialFile(fmt, oc);
av_write_header(oc);
WaitVideoStart();
cWriteNextFile = 0;
printf("\n[AVI_SAVE]create a new file:%s,%d\n",oc->filename,iRet);
if(0 != iRet)
{
printf("\n[AVI_SAVE]Something are error,Check it! :-(\n");
return 99;
}
}
/* compute current audio and video time */
if (audio_st)
audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
else
audio_pts = 0.0;
if (video_st)
video_pts = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den;
else
video_pts = 0.0;
if ((!audio_st || audio_pts >= (double)STREAM_DURATION+Pts_Addon_Duration) &&
(!video_st || video_pts >= (double)STREAM_DURATION+Pts_Addon_Duration))
{
fprintf(stderr,"video_pts=%lf,(double)STREAM_DURATION+Pts_Addon_Duration)=%lf\n",video_pts,(double)STREAM_DURATION+Pts_Addon_Duration);
break;
}
//if( nIsChkcard == 1 )
if( CheckFileLimit(oc, filelimit, nIsChkcard) < 0)
{
cWriteNextFile = 1;
GetAudioInterface(NULL,NULL,NULL,1);
GetVideoInterface(NULL,NULL,NULL,NULL,1);
/* write the trailer, if any */
av_write_trailer(oc);
printf("\n[AVI_SAVe]av_write_trailer\n");
/* close each codec */
if (video_st)
close_video(oc, video_st);
if (audio_st)
close_audio(oc, audio_st);
if (!(fmt->flags & AVFMT_NOFILE)) {
/* close the output file */
url_fclose(oc->pb);
}
if( nIsChkcard == 1 ) {
printf("filename = %s\n", filename);
printf("cFilename = %s\n", cFilename);
iRet = rename(filename, cFilename); //return 1 rename fail
if(iRet != 0)
{
SDRemount();
iRet = rename(filename, cFilename);
if(iRet != 0)
{
printf("[main]rename %s to %s fail!\n", filename, cFilename);
exit(0);
}
}
}
//清除已录制完的文件名记录
iRet = SetRecordFileInfo(NULL, nIsChkcard);
if(iRet == -1)
{
SDRemount();
iRet = SetRecordFileInfo(NULL, nIsChkcard);
if(iRet == -1)
{
printf("[main]Can not open reclog.dat!\n");
exit(0);
}
}
}
if( nIsChkcard != 1 )
{
if( GetfreememInfo() < 0 )
{
nChkcardFlag = 1;
break;
}
}
if(1 != cWriteNextFile){
video_ret = -1;
audio_ret = -1;
/* write interleaved audio and video frames */
if (!video_st || (video_st && audio_st && audio_pts < video_pts)) {
audio_ret = write_audio_frame(oc, audio_st);
} else {
video_ret = write_video_frame(oc, video_st);
}
if( video_ret < 0 && audio_ret < 0 )
{
usleep(10000);
}
}
}
[/code]现在附上于此相关的一段代码 肯定大家分析一下
SD卡存贮过程中 约定好256M 打包一段视频 现在两段视频之间会又1s中左右的视频丢失 有时候也没有 不知道是什么原因
[code]while( AbortSignal == 0 )
{
if(cWriteNextFile)
{
int iRet = 0;
videoLasttime = -1;
syncIframe = 0;
lastCnt = -1;
audioLasttime = -1;
LastCnt = -1;
basetime = 0;
Audio_Serial_Start = -1;
Video_Serial_Start = 0;
audio_frame_count=0;
video_frame_count=0;
if(nIsChkcard == 1)
{
#ifdef CIRCULAR_REC_ENABLE
memset(cFilename, 0, sizeof(cFilename));
AV_GetCurrentFileName(cFilename);
GetvalidFilename(filename);
filelimit = GetFilelimitSize(filename);
printf("[main] filename = %s, filelimit = %ld", filename, (long)filelimit);
#else
if(IsLimit_Reach == 2)
{
printf("\n[AVI_SAVE]Space is not enough,Exit\n");
IsLimit_Reach = 0;
return 99;
}
#endif
}else{
if(IsLimit_Reach == 2)
{
printf("\n[AVI_SAVE]Space is not enough,Exit\n");
IsLimit_Reach = 0;
return 99;
}
}
av_reset_stream(video_st);
av_reset_stream(audio_st);
/* now that all the parameters are set, we can open the audio and
video codecs and allocate the necessary encode buffers */
if (video_st)
open_video(oc, video_st);
if (audio_st)
open_audio(oc, audio_st);
if(nIsChkcard == 1)
AV_Open_File(fmt, oc, filename);
else
iRet = AV_Save_WriteSerialFile(fmt, oc);
av_write_header(oc);
WaitVideoStart();
cWriteNextFile = 0;
printf("\n[AVI_SAVE]create a new file:%s,%d\n",oc->filename,iRet);
if(0 != iRet)
{
printf("\n[AVI_SAVE]Something are error,Check it! :-(\n");
return 99;
}
}
/* compute current audio and video time */
if (audio_st)
audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
else
audio_pts = 0.0;
if (video_st)
video_pts = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den;
else
video_pts = 0.0;
if ((!audio_st || audio_pts >= (double)STREAM_DURATION+Pts_Addon_Duration) &&
(!video_st || video_pts >= (double)STREAM_DURATION+Pts_Addon_Duration))
{
fprintf(stderr,"video_pts=%lf,(double)STREAM_DURATION+Pts_Addon_Duration)=%lf\n",video_pts,(double)STREAM_DURATION+Pts_Addon_Duration);
break;
}
//if( nIsChkcard == 1 )
if( CheckFileLimit(oc, filelimit, nIsChkcard) < 0)
{
cWriteNextFile = 1;
GetAudioInterface(NULL,NULL,NULL,1);
GetVideoInterface(NULL,NULL,NULL,NULL,1);
/* write the trailer, if any */
av_write_trailer(oc);
printf("\n[AVI_SAVe]av_write_trailer\n");
/* close each codec */
if (video_st)
close_video(oc, video_st);
if (audio_st)
close_audio(oc, audio_st);
if (!(fmt->flags & AVFMT_NOFILE)) {
/* close the output file */
url_fclose(oc->pb);
}
if( nIsChkcard == 1 ) {
printf("filename = %s\n", filename);
printf("cFilename = %s\n", cFilename);
iRet = rename(filename, cFilename); //return 1 rename fail
if(iRet != 0)
{
SDRemount();
iRet = rename(filename, cFilename);
if(iRet != 0)
{
printf("[main]rename %s to %s fail!\n", filename, cFilename);
exit(0);
}
}
}
//清除已录制完的文件名记录
iRet = SetRecordFileInfo(NULL, nIsChkcard);
if(iRet == -1)
{
SDRemount();
iRet = SetRecordFileInfo(NULL, nIsChkcard);
if(iRet == -1)
{
printf("[main]Can not open reclog.dat!\n");
exit(0);
}
}
}
if( nIsChkcard != 1 )
{
if( GetfreememInfo() < 0 )
{
nChkcardFlag = 1;
break;
}
}
if(1 != cWriteNextFile){
video_ret = -1;
audio_ret = -1;
/* write interleaved audio and video frames */
if (!video_st || (video_st && audio_st && audio_pts < video_pts)) {
audio_ret = write_audio_frame(oc, audio_st);
} else {
video_ret = write_video_frame(oc, video_st);
}
if( video_ret < 0 && audio_ret < 0 )
{
usleep(10000);
}
}
}
[/code]现在附上于此相关的一段代码 肯定大家分析一下
我来回答
回答0个
时间排序
认可量排序
暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2015-06-24 14:08:46
-
2015-05-26 09:43:03
-
2017-01-03 17:08:16
-
2015-05-18 12:54:36
-
2016-05-17 08:47:27
-
2020-12-29 10:15:09
-
2016-11-24 20:36:21
-
2015-10-29 13:54:46
-
2015-09-25 15:19:16
-
2015-05-05 18:55:25
-
2016-04-27 16:46:00
-
2017-04-15 15:47:36
-
92015-08-12 15:05:12
-
2017-07-28 16:20:03
-
2019-12-06 10:05:41
-
2018-03-01 16:47:07
-
2017-02-23 10:08:37
-
2018-01-24 16:43:37
-
2017-05-19 16:28:28
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5SS928的emmc有32GB,bootargs设置使用16GB,但是为啥能用的只有rootfs的大小
-
33SS928怎样烧写ubuntu系统
-
10ToolPlatform下载rootfs提示网络失败
-
10谁有GK7205V500的SDK
-
5Hi3516CV610 烧录不进去
-
10Hi3559AV100 芯片硬解码h265编码格式的视频时出现视频播放错误,解码错误信息 s32PackErr:码流有错
-
5海思SS928 / SD3403的sample_venc.c摄像头编码Demo中,采集到的摄像头的YUV数据在哪个相关的函数中?
-
5海鸥派openEuler无法启动网卡,连接WIFI存在问题
-
66有没有ISP相关的巨佬帮忙看看SS928对接IMX347的图像问题
-
50求助hi3559与FPGA通过SLVS-EC接口对接问题
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认