3999
- 收藏
- 点赞
- 分享
- 举报
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
-
2016-11-24 20:36:21
-
2020-12-29 10:15:09
-
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
-
2018-01-24 16:43:37
-
2017-02-23 10:08:37
-
2015-11-09 18:10:30
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认