diff --git a/cmvr-es/devices/camera/uvc_camera/src/uvc_camera.cpp b/cmvr-es/devices/camera/uvc_camera/src/uvc_camera.cpp index a789a79b..9e04bd2a 100644 --- a/cmvr-es/devices/camera/uvc_camera/src/uvc_camera.cpp +++ b/cmvr-es/devices/camera/uvc_camera/src/uvc_camera.cpp @@ -430,6 +430,15 @@ bool UVCCamera::open_capture_() } result = avcodec_parameters_to_context(capture_decoder_context_, video_stream->codecpar); + if (result >= 0) { + const AVRational stream_time_base = video_stream->time_base; + capture_decoder_context_->pkt_timebase = + stream_time_base.num > 0 && stream_time_base.den > 0 + ? stream_time_base + : AVRational{1, AV_TIME_BASE}; + capture_decoder_context_->framerate = av_guess_frame_rate( + capture_format_context_, video_stream, nullptr); + } if (result >= 0) { AVBufferRef* vaapi_device_context = nullptr; result = av_hwdevice_ctx_create( @@ -473,6 +482,8 @@ bool UVCCamera::open_capture_() << ", hardware_device=qsv" << ", width=" << capture_decoder_context_->width << ", height=" << capture_decoder_context_->height + << ", packet_time_base=" << capture_decoder_context_->pkt_timebase.num + << "/" << capture_decoder_context_->pkt_timebase.den << ", requested_fps=" << fps_; return true; }