1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #16713 from VadimLevin:dev/vlevin/ffmpeg_video_capture_bitrate

* feature: Add video capture bitrate read-only property for FFMPEG backend

* test: For WIN32 property should be either expected or 0.

Added `IsOneOf` helper function, enabled only for _WIN32.
This commit is contained in:
Vadim Levin
2020-03-10 16:44:22 +03:00
committed by GitHub
parent 490908f0ff
commit 09fe66e87f
4 changed files with 71 additions and 4 deletions
+2 -1
View File
@@ -27,7 +27,8 @@ enum
CV_FFMPEG_CAP_PROP_FORMAT=8,
CV_FFMPEG_CAP_PROP_SAR_NUM=40,
CV_FFMPEG_CAP_PROP_SAR_DEN=41,
CV_FFMPEG_CAP_PROP_CODEC_PIXEL_FORMAT=46
CV_FFMPEG_CAP_PROP_CODEC_PIXEL_FORMAT=46,
CV_FFMPEG_CAP_PROP_BITRATE=47
};
typedef struct CvCapture_FFMPEG CvCapture_FFMPEG;
+5 -3
View File
@@ -492,7 +492,7 @@ struct CvCapture_FFMPEG
int64_t get_total_frames() const;
double get_duration_sec() const;
double get_fps() const;
int get_bitrate() const;
int64_t get_bitrate() const;
double r2d(AVRational r) const;
int64_t dts_to_frame_number(int64_t dts);
@@ -1433,6 +1433,8 @@ double CvCapture_FFMPEG::getProperty( int property_id ) const
if (rawMode)
return -1;
break;
case CV_FFMPEG_CAP_PROP_BITRATE:
return static_cast<double>(get_bitrate());
default:
break;
}
@@ -1457,9 +1459,9 @@ double CvCapture_FFMPEG::get_duration_sec() const
return sec;
}
int CvCapture_FFMPEG::get_bitrate() const
int64_t CvCapture_FFMPEG::get_bitrate() const
{
return ic->bit_rate;
return ic->bit_rate / 1000;
}
double CvCapture_FFMPEG::get_fps() const