Audio MSMF: added the ability to set sample per second
* Audio MSMF: added the ability to set sample per second
* changed the valid sampling rate check
* fixed docs
* add test
* fixed warning
* fixed error
* fixed error
Add capacity to Videocapture to return the extraData from FFmpeg when required
* Update rawMode to append any extra data recieved during the initial negotiation of an RTSP stream or during the parsing of an MPEG4 file header.
For h264[5] RTSP streams this ensures the parameter sets if available are always returned on the first call to grab()/read() and has two purposes:
1) To ensure the parameter sets are available even if they are not transmitted in band. This is common for axis ip camera's.
2) To allow callers of VideoCapture::grab()[read()] to write to split the raw stream over multiple files by appending the parameter sets to the begining of any new files.
For (1) there is no alternative, for (2) if the parameter sets were provided in band it would be possible to parse the raw bit stream and search for the parameter sets however that would be a lot of work when that information is already provided by FFMPEG.
For MPEG4 files this information is only suplied in the header and is required for decoding.
Two properties are also required to enable the raw encoded bitstream to be written to multiple files, these are;
1) an indicator as to whether the last frame was a key frame or not - each new file needs to start at a key frame to avoid storing unusable frame diffs,
2) the length in bytes of the paramater sets contained in the last frame - required to split the paramater sets from the frame without having to parse the stream. Any call to VideoCapture::get(CAP_PROP_LF_PARAM_SET_LEN) returning a number greater than zero indicates the presense of a parameter set at the begining of the raw bitstream.
* Adjust test data to account for extraData
* Address warning.
* Change added property names and remove paramater set start code check.
* Output extra data on calls to retrieve instead of appending to the first packet.
* Reverted old test case and added new one to evaluate new functionality.
* Add missing definition.
* Remove flag from legacy api.
Add property to determine if returning extra data is supported.
Always allow extra data to be returned on calls to cap.retrieve()
Update test case.
* Update condition which indicates CAP_PROP_CODEC_EXTRADATA_INDEX is not supported in test case.
* Include compatibility for windows dll if not updated.
Enforce existing return status convention.
* Fix return error and missing test constraints.
Add CAP_PROP_STREAM_OPEN_TIME
* Added CAP_PROP_STREAM_OPEN_TIME to videoio module - can be used to query the time at which the stream was opened, in seconds since Jan 1 1970 (midnight, UTC). Useful for RTSP and other live video where absolute timestamps are needed. Only applicable to ffmpeg backends
* use nanoseconds instead of seconds to mark the stream open time, and change the cap prop name to CAP_PROP_STREAM_OPEN_TIME_NSEC
* use microseconds for CAP_PROP_STREAM_OPEN_TIME (nanoseconds rolls over too soon, and milliseconds/seconds requires a division)
* fix whitespace issue
* VideoCapture timeout set/get
* Common formatting for enum values
* Fix enum values wrongly in videoio.hpp
* Define timeout enum values in public api and align with master
videoio: HW decode/encode in FFMPEG backend; new properties with support in FFMPEG/GST/MSMF
* HW acceleration in FFMPEG backend
* fixes on Windows, remove D3D9
* HW acceleration in FFMPEG backend
* fixes on Windows, remove D3D9
* improve va test
* Copyright
* check LIBAVUTIL_BUILD >= AV_VERSION_INT(55, 78, 100) // FFMPEG 3.4+
* CAP_MSMF test on .mp4
* .mp4 in test
* improve va test
* Copyright
* check LIBAVUTIL_BUILD >= AV_VERSION_INT(55, 78, 100) // FFMPEG 3.4+
* CAP_MSMF test on .mp4
* .mp4 in test
* .avi for GStreamer test
* revert changes around seek()
* cv_writer_open_with_params
* params.warnUnusedParameters
* VideoCaptureParameters in GStreamer
* open_with_params
* params->getUnused
* Reduce PSNR threshold 33->32 (other tests use 30)
* require FFMPEG 4.0+; PSNR 30 as in other tests
* GStreamer AVI-demux plugin not installed in Ubuntu test environment?
* fix build on very old ffmpeg
* fix build on very old ffmpeg
* fix build issues
* fix build issues (static_cast)
* FFMPEG built on Windows without H264 encoder?
* fix for write_nothing test on VAAPI
* fix warnings
* fix cv_writer_get_prop in plugins
* use avcodec_get_hw_frames_parameters; more robust fallback to SW codecs
* internal function hw_check_device() for device check/logging
* two separate tests for HW read and write
* image size 640x480 in encode test
* WITH_VA=ON (only .h headers used in OpenCV, no linkage dependency)
* exception on VP9 SW encoder?
* rebase master; refine info message
* videoio: fix FFmpeg standalone plugin build
* videoio(ffmpeg): eliminate MSVC build warnings
* address review comments
* videoio(hw): update videocapture_acceleration.read test
- remove parallel decoding by SW code path
- check PSNR against the original generated image
* videoio: minor fixes
* videoio(test): disable unsupported MSMF cases (SW and HW)
* videoio(test): update PSNR thresholds for HW acceleration read
* videoio(test): update debug messages
* "hw_acceleration" whitelisting parameter
* little optimization in test
* D3D11VA supports decoders, doesn't support encoders
* videoio(test): adjust PSNR threshold in write_read_position tests
* videoio(ffmpeg): fix rejecting on acceleration device name mismatch
* videoio(ffmpeg): fix compilation USE_AV_HW_CODECS=0, add more debug logging
* videoio: rework VideoAccelerationType behavior
- enum is not a bitset
- default value is backend specific
- only '_NONE' and '_ANY' may fallback on software processing
- specific H/W acceleration doesn't fallback on software processing. It fails if there is no support for specified H/W acceleration.
* videoio(test): fix for current FFmpeg wrapper
Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
add video capture parameters
* add parameters
* videoio: revert unnecessary massive changes
* videoio: support capture parameters in backends API
- add tests
- FFmpeg backend sample code
- StaticBackend API is done
- support through PluginBackend API will be added later
Co-authored-by: Milashchenko <maksim.milashchenko@intel.com>
Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
Add CV_16UC1/GRAY16_LE support to GStreamer backend for VideoWriter
* videoio(backend): add Writer_open_with_params to plugin API
This will allow arbitrary parameters to be passed to plugin backends
* videoio(gstreamer): add GRAY16_LE/CV_16UC1 writing support to GStreamer
This introduces a new property VIDEOWRITER_PROP_DEPTH, which defaults to
CV_8U, but for GStreamer can be set to CV_16U.
Also, fix another test to not fail if plugin isn't found, copying logic
from the read_write test.
* videoio(plugin): fix handling plugins with previous API level
* videoio: coding style
* fix warning
uEye are cameras from IDS, c.f. https://en.ids-imaging.com/
Supports driver version 4.94 and up currently, since the event system was overhauled there.
Supports setting/getting the properties: fps,width,height
- Add VideoCapture camera orientation property for mp4 videos with camera orientation meta.
- Add auto rotation for 90, 180, 270 degrees using cv::rotate
* feature: Extend VideoWriter to accept vector of parameters
- Add additional constructor and `open` method for `VideoWriter`
those accept a vector of parameters
- Move actual implementation of the `VideoWriter::open` to general method
which accepts vector of parameters
- Propagate parsed parameters map up to actual video backend construction
* fix: Change VideoWriter constructor description to suppress doc warning
* refactor: Rollback newlines changes
* feature: Changed VideoWriter parameters workflow
* feature: Log unused parameters in VideoWriter open
* doc: Fix VideoWriter `isColor` parameter description
* fix: int to bool VC++ conversion warning
* doc: Remove information about `isColor` flag usage.
* 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.
- Added `explicit` to `VideoCapture` constructors with 2
arguments, 1 of them has default value
- Applied library code style
- Introduced 2 debug macros to improve readability of the code
Add retrieve encoded frame to VideoCapture
* Add capacity to retrieve the encoded frame from a VideoCapture object.
* Correct raw codec and pixle format output from ffmpeg capture.
* Remove warnings from build.
* Added VideoCaptureRaw subclass.
* Include abstract base class VideoCaptureBase and rename new subclass VideoContainer as suggested by mshabunin.
* Remove using.
* Change base class name for compatibility with jave bindings generator.
* Move grab and retrieve and add override specifier
* Add setRaw and readRaw to IVideoCapture interface
-setRaw to disable video decoding and enable bitstream filters from mp4 to h254 and h265.
-readRaw to return the raw undecoded/filtered bitstream.
Add createRawCapture to initiate a backend with setRaw enabled.
Remove inheritance and use an independant VideoContainer subclass with IVideoCapture member.
* Address unused parameter warings.
Remove VideoContainer from python bindings as it no longer returns a Mat.
Use opencv type uchar instead of unsigned char.
Add missing destructor to VideoContainer class.
* Address build warnings and include all params in documentation.
* Include deprecated bitstream filtering API.
* Update codec_id query to work with older ffmpeg api's.
Change api version defines to be consistent - most recent api version first.
* Fix typo.
* Update test to work with naming of new files in the extra repo
* Investigate test failure
* Check bytes read by ffmpeg
* Removed mp4 video container test
* Applied suggested changes.
* videoio: rework API for extraction of RAW video streams
- FFmpeg only
* address review comments
Implement Camera Multiplexing API
* IdideoCapture + two wrong function
function waitAny
Add errors catcher
Stub for Python added.
Sifting warnings
One test added
Two tests for camera and Perf tests added
* Perf sync and async tests for waitAny() added, waitAnyInterior() deleted, getDeviceHandle() deleted
* Variable OPENCV_TEST_CAMERA_LIST added
* Without fps set
* ASSERT_FAILED for environment variable
* Perf tests is DISABLED_
* --Trailing whitespace
* Return false from cap.cpp deleted
* Two functions deleted from interface, +range for, +environment variable in test_camera
* Space deleted
* printf deleted, perror added
* CV_WRAP deleted, cv2 cleared from stubs
* -- space
* default timeout added
* @param changed
* place of waitAny changed
* --whitespace
* ++function description
* function description changed
* revert unused changes
* videoio: rework API for VideoCapture::waitAny()
* videoio(librealsense): fix pipeline start with config
fix to apply pipeline settings by passing config to start.
* videoio(librealsense): add support get props
add support get some props.
cap_libv4l depends on an external library (libv4l) yet is still larger
(1966 loc vs 1822 loc).
It was initially introduced copy pasting cap_v4l in order to offload
various color conversions to libv4l.
However nowadays we handle most of the needed color conversions inside
OpenCV. Our own implementation is better tested and (probably) also
better performing. (as it can optionally leverage IPP/ OpenCL)
Currently cap_v4l is better maintained and generally the code is in
better shape. There is however an API
difference in getting unconverted frames:
* on cap_libv4l one need to set `CV_CAP_MODE_GRAY=1` or
`CV_CAP_MODE_YUYV=1`
* on cap_v4l one needs to set `CV_CAP_PROP_CONVERT_RGB=0`
the latter is more flexible though as it also allows accessing undecoded
JPEG images.
fixes#4563
V4L (V4L2): Refactoring. Added missed camera properties. Fixed getting `INF` for some properties. Singlethread as always (#12893)
* cap_v4l:
1 Added cap_properties verbalization.
2 Set Get of properties elementary refactoring.
3 Removed converting parameters to/from [0,1] range.
4 Added all known conversion from V4L2_CID_* to CV_CAP_PROP_*
* cap_v4l:
1. Removed all query for parameters range.
2. Refactored capture initialization.
3. Added selecting input channel by CV_CAP_PROP_MODE. Default value -1 the channels not changed.
* cap_v4l:
1. Refactoring of Convert To RGB
* cap_v4l:
1. Fixed use of video buffer index.
2. Removed extra memcopy for grab image.
3. Removed device closing from autosetup_capture_mode_v4l2
* cap_v4l:
1. The `goto` was eliminated
2. Fixed use of temporary buffer index for V4L2_PIX_FMT_SN9C10X
3. Fixed use of the bufferIndex
4. Removed trailing spaces and unused variables.
* cap_v4l:
1. Alias for capture->buffers[capture->bufferIndex]
2. Reduced size of data for memcpy: bytesused instead of length
3. Refactoring. Code duplication. More info for debug
* cap_v4l:
1. Added the ability to grab and retrieveFrame independently several times
* cap_v4l:
1. Not need to close/open device for new capture parameters applying.
2. Removed using of device name as a flag that the capture is closed. Added sufficient function.
3. Refactoring. Added requestBuffers and createBuffers
* cap_v4l:
1. Added tryIoctl with `select` like was in mainloop_v4l2.
2. Fixed buffer request for device without closing the device.
3. Some static function moved to CvCaptureCAM_V4L
4. Removed unused defines
* cap_v4l:
1. Thread-safe now
* cap_v4l:
1. Fixed thread-safe destructor
2. Fixed FPS setting
* Missed brake
* Removed thread-safety
* cap_v4l:
1. Reverted conversion parameters to/from [0,1] by default for backward compatibility.
2. Added setting for turn off compatibility mode: set CV_CAP_PROP_MODE to 65536
3. Most static functions moved to CvCaptureCAM_V4L
4. Refactoring of icvRetrieveFrameCAM_V4L and using of frame_allocated flag
* cap_v4l:
1. Added conversion to RGB from NV12, NV21
2. Refactoring. Removed wrappers for known format conversions.
* Added `CAP_PROP_CHANNEL` to the enum VideoCaptureProperties.
CAP_V4L migrated to use VideoCaptureProperties.
* 1. Update comments.
2. Environment variable `OPENCV_VIDEOIO_V4L_RANGE_NORMALIZED` for setting default backward compatibility mode.
3. Revert getting of `CAP_PROP_MODE` as fourcc code in backward compatibility mode.
* videoio: update cap_v4l - compatibilityMode => normalizePropRange
* videoio(test): V4L2 MJPEG test
`v4l2-ctl --list-formats` should have 'MJPG' entry
* videoio: fix buffer initialization
to avoid "munmap: Invalid argument" messages
* Update videoio.hpp
add VideoCapturePropertie for clossbar input pin setting
* Update cap_dshow.cpp
For some kind of capture card, such as "avermedia cv710 " , it use SerialDigital as input pin and so it can not work.
Here added new PhysicalConnectorType enumeration: PhysConn_Video_YRYBY and PhysConn_Video_SerialDigital to support it.
And also provide new property parameter CAP_CROSSBAR_INPIN_TYPE to set the crossbar input pin type which will be used in videoInput::start(int deviceID, videoDevice *VD):
" if(VD->useCrossbar)
{
DebugPrintOut("SETUP: Checking crossbar\n");
routeCrossbar(&VD->pCaptureGraph, &VD->pVideoInputFilter, VD->connection, CAPTURE_MODE);
}
"
And at last ,fixed one issue for function setSizeAndSubtype, added code
pVih->rcSource.top = pVih->rcSource.left = pVih->rcTarget.top =pVih->rcTarget.left=0;
pVih->rcSource.right = pVih->rcTarget.right= attemptWidth;
pVih->rcSource.bottom = pVih->rcTarget.bottom = attemptHeight;
without these code , rcSource and rcTarget will keeping use default resolution and cause fail in hr = VD->streamConf->SetFormat(VD->pAmMediaType) and cannot find suitable MediaType.
Tested with python3 and mfc (Avermedia cv710)
Python3 code:
import cv2
print("test cv")
cap=cv2.VideoCapture(0)
cap.set(5,60)
cap.set(3,1920)
cap.set(4,1080)
cap.set(31,6)
ret,img=cap.read()
cv2.namedWindow("cap",cv2.WINDOW_NORMAL)
cv2.resizeWindow("cap",960,640);
while True:
ret,img=cap.read()
if ret==False:
continue
cv2.imshow("cap",img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
MFC code:
void CcvtestDlg::OnBnClickedButton1()
{
VideoCapture cap(0);
cap.set(CAP_PROP_FRAME_WIDTH, 1920);
cap.set(CAP_PROP_FRAME_HEIGHT, 1080);
cap.set(CAP_CROSSBAR_INPIN_TYPE , 6);
Mat img;
namedWindow("test", WINDOW_NORMAL);
resizeWindow("test", 960, 640);
while (1)
{
if (cap.read(img))
{
imshow("test", img);
if ('q' ==waitKey(1))
break;
}
}
destroyAllWindows();
cap.release();
}
* Update cap_dshow.cpp
* Update videoio.hpp
move enum value of CAP_CROSSBAR_INPIN_TYPE to the end of list
* Update videoio.hpp
* Update cap_dshow.cpp
removed trailing whitespace
* Update test_camera.cpp
Add test for capture device using PhysConn_Video_SerialDigital as crossbar input pin
* Update test_camera.cpp
Correction of misunderstanding about how to add test case.