From 264dff523197b4bde6a6fc70b687901524de8cbd Mon Sep 17 00:00:00 2001 From: Alexander Reshetnikov Date: Mon, 9 Apr 2012 13:35:48 +0000 Subject: [PATCH] Fixed ffmpeg encoding error (ticket #1743) --- modules/highgui/src/cap_ffmpeg_impl.hpp | 1 + modules/highgui/src/cap_ffmpeg_impl_v2.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/highgui/src/cap_ffmpeg_impl.hpp b/modules/highgui/src/cap_ffmpeg_impl.hpp index fa847ce3b4..c154abeb31 100644 --- a/modules/highgui/src/cap_ffmpeg_impl.hpp +++ b/modules/highgui/src/cap_ffmpeg_impl.hpp @@ -966,6 +966,7 @@ int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st, uint8_ av_init_packet(&pkt); #if LIBAVFORMAT_BUILD > 4752 + if(c->coded_frame->pts != (int64_t)AV_NOPTS_VALUE) pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, video_st->time_base); #else pkt.pts = c->coded_frame->pts; diff --git a/modules/highgui/src/cap_ffmpeg_impl_v2.hpp b/modules/highgui/src/cap_ffmpeg_impl_v2.hpp index e14794b8af..a83987445f 100755 --- a/modules/highgui/src/cap_ffmpeg_impl_v2.hpp +++ b/modules/highgui/src/cap_ffmpeg_impl_v2.hpp @@ -1085,6 +1085,7 @@ int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st, uint8_ av_init_packet(&pkt); #if LIBAVFORMAT_BUILD > 4752 + if(c->coded_frame->pts != (int64_t)AV_NOPTS_VALUE) pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, video_st->time_base); #else pkt.pts = c->coded_frame->pts;