0
비디오 스트림에서 버퍼로 비디오 패킷을 씁니다. 그런 다음 파일에 기록하려고합니다.avcodec on C, 고정 이미지
av_init_packet(&pkt);
int bufer_size=250;
while (av_read_frame(ifcx, &pkt) >= 0 && start_flag==0 && stop_flag==0){
printf("reading packet - %i \n", pkg_index);
if (pkt.stream_index == i_index) {
pkt.stream_index = ost->id;
pkt.pts = av_rescale_q_rnd(pkt.pts, ist->time_base, ost->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
pkt.dts = av_rescale_q_rnd(pkt.dts, ist->time_base, ost->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
pkt.duration = av_rescale_q(pkt.duration, ist->time_base, ost->time_base);
pkt.pos = -1;
av_copy_packet(&pkt_arr[pkg_index],&pkt);
}
av_free_packet(&pkt);
av_init_packet(&pkt);
pkg_index++;
if(pkg_index>=bufer_size){
int ret = avformat_write_header(ofcx, NULL);
av_dump_format(ofcx, 0, ofcx->filename, 1);
int i;
int start_frame=0;
for(i=start_frame; i<bufer_size; i++){
av_interleaved_write_frame(ofcx, &pkt_arr[i]);
}
av_write_trailer(ofcx);
avio_close(ofcx->pb);
printf("END \n");
return 0;
}
}
이제 문제가 생겼습니다 : start_frame = 0 인 경우 everithing이 정상입니다. 10 초의 비디오 파일이 있습니다. 하지만 start_frame = 125 (예 : resault)에서 i는 5 초의 고정 된 그림과 5 초의 비디오를 가진 비디오 파일을 가지고 있습니다.
무엇이 잘못 되었나요?
[avi @ 0x287a9f0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 6 >= 1
[avi @ 0x287a9f0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 6 >= 2
[avi @ 0x287a9f0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 6 >= 3
[avi @ 0x287a9f0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 6 >= 4
[avi @ 0x287a9f0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 6 >= 5
[avi @ 0x287a9f0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 6 >= 6
어쩌면 당신이 무엇을 알고
는 말에 나는 오류가 있습니다.