diff --git a/src/video_provider_bestsource.cpp b/src/video_provider_bestsource.cpp index 3b5e0834c..a75a8c676 100644 --- a/src/video_provider_bestsource.cpp +++ b/src/video_provider_bestsource.cpp @@ -147,7 +147,7 @@ BSVideoProvider::BSVideoProvider(agi::fs::path const& filename, std::string cons Keyframes.push_back(n); } - TimecodesVector.push_back((int) frame->GetAVFrame()->pts); + TimecodesVector.push_back(frame->Pts * properties.TimeBase.Den / properties.TimeBase.Num); ps->SetProgress(n, properties.NumFrames); } @@ -182,6 +182,14 @@ void BSVideoProvider::GetFrame(int n, VideoFrame &out) { throw VideoDecodeError("Couldn't convert frame!"); } + int range = frame->color_range == AVCOL_RANGE_JPEG; + const int *coefficients = sws_getCoefficients(frame->colorspace == AVCOL_SPC_UNSPECIFIED ? AVCOL_SPC_BT709 : frame->colorspace); + + sws_setColorspaceDetails(context, + coefficients, range, + coefficients, range, + 0, 1 << 16, 1 << 16); + out.data.resize(frame->width * frame->height * 4); uint8_t *data[1] = {&out.data[0]}; int stride[1] = {frame->width * 4};