title: cv2.VideoCapture(0).read() returns (False, None)
body: <pre><code>import cv2
  cap=cv2.VideoCapture(0)
  cap.set(3,640)#width
  cap.set(4,480)#height
  cap.set(10,100)#brightness
  while True:
      success, img = cap.read()
      print(img)#getting None
      print(success)#getting False
      cv2.imshow(&quot;video&quot;, img)
      cv2.waitKey(1)
      if 0xFF == ord('q') :
          break
  </code></pre>
  <p>VideoCapture worked well with an mp4 video. But when I tried to use it for my laptop webcam it doesn't work.
  Running this code for the first-time on my laptop using pyCharm.
  At first, the webcam itself was not opening. So, I checked in <a href="https://stackoverflow.com/questions/57230407/process-finished-with-exit-code-134-interrupted-by-signal-6-sigabrt-in-python">here</a> and added the following in /Applications/PyCharm\ CE.app/Contents/Info.plist</p>
  <pre><code>&lt;key&gt;Privacy - Camera Usage&lt;/key&gt;
  &lt;string&gt;An application in PyCharm wants to use the camera&lt;/string&gt;
  </code></pre>
  <p>After the webcam is getting started when I run the code but imshow is returning None.</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/Users/sreeharsha/PycharmProjects/OpencvPython/chapter1.py&quot;, line 26, in &lt;module&gt;
      cv2.imshow(&quot;video&quot;, img)
  cv2.error: OpenCV(4.4.0) /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-4jcifzim/opencv/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width&gt;0 &amp;&amp; size.height&gt;0 in function 'imshow'
  </code></pre>
  <p>cap.isOpened() is returning True
  When I try cap.getBackendName() it returns the following error</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/Users/sreeharsha/PycharmProjects/OpencvPython/chapter1.py&quot;, line 16, in &lt;module&gt;
      print(cap.getBackendName())
  cv2.error: OpenCV(4.4.0) /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-4jcifzim/opencv/modules/videoio/src/cap.cpp:299: error: (-215:Assertion failed) api != 0 in function 'getBackendName'
  </code></pre>
  <p>cv2.getBuildInformation() is as follows</p>
  <pre><code>
  General configuration for OpenCV 4.4.0 =====================================
    Version control:               4.4.0-dirty
  
    Platform:
      Timestamp:                   2020-09-22T21:19:42Z
      Host:                        Darwin 17.7.0 x86_64
      CMake:                       3.18.2
      CMake generator:             Unix Makefiles
      CMake build tool:            /usr/bin/make
      Configuration:               Release
  
    CPU/HW features:
      Baseline:                    SSE SSE2 SSE3 SSSE3 SSE4_1
        requested:                 DETECT
      Dispatched code generation:  SSE4_2 FP16 AVX AVX2 AVX512_SKX
        requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
        SSE4_2 (1 files):          + POPCNT SSE4_2
        FP16 (0 files):            + POPCNT SSE4_2 FP16 AVX
        AVX (4 files):             + POPCNT SSE4_2 AVX
        AVX2 (29 files):           + POPCNT SSE4_2 FP16 FMA3 AVX AVX2
        AVX512_SKX (4 files):      + POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
  
    C/C++:
      Built as dynamic libs?:      NO
      C++ standard:                11
      C++ Compiler:                /usr/local/opt/ccache/libexec/clang++  (ver 9.1.0.9020039)
      C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
      C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
      C Compiler:                  /usr/local/opt/ccache/libexec/clang
      C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
      C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
      Linker flags (Release):      -Wl,-dead_strip  
      Linker flags (Debug):        -Wl,-dead_strip  
      ccache:                      YES
      Precompiled headers:         NO
      Extra dependencies:          -framework OpenCL /Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Accelerate.framework -lm -ldl ade Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent openjp2
      3rdparty dependencies:       ittnotify libprotobuf zlib libjpeg-turbo libwebp libpng libtiff IlmImf quirc ippiw ippicv
  
    OpenCV modules:
      To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio
      Disabled:                    world
      Disabled by dependency:      -
      Unavailable:                 java js python2 ts
      Applications:                -
      Documentation:               NO
      Non-free algorithms:         NO
  
    GUI: 
      QT:                          YES (ver 5.13.2)
        QT OpenGL support:         NO
      Cocoa:                       YES
      VTK support:                 NO
  
    Media I/O: 
      ZLib:                        build (ver 1.2.11)
      JPEG:                        build-libjpeg-turbo (ver 2.0.5-62)
      WEBP:                        build (ver encoder: 0x020f)
      PNG:                         build (ver 1.6.37)
      TIFF:                        build (ver 42 - 4.0.10)
      JPEG 2000:                   OpenJPEG (ver 2.3.1)
      OpenEXR:                     build (ver 2.3.0)
      HDR:                         YES
      SUNRASTER:                   YES
      PXM:                         YES
      PFM:                         YES
  
    Video I/O:
      DC1394:                      NO
      FFMPEG:                      YES
        avcodec:                   YES (58.91.100)
        avformat:                  YES (58.45.100)
        avutil:                    YES (56.51.100)
        swscale:                   YES (5.7.100)
        avresample:                YES (4.0.0)
      GStreamer:                   NO
      AVFoundation:                YES
  
    Parallel framework:            GCD
  
    Trace:                         YES (with Intel ITT)
  
    Other third-party libraries:
      Intel IPP:                   2020.0.0 Gold [2020.0.0]
             at:                   /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-4jcifzim/_skbuild/macosx-10.13-x86_64-3.7/cmake-build/3rdparty/ippicv/ippicv_mac/icv
      Intel IPP IW:                sources (2020.0.0)
                at:                /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-4jcifzim/_skbuild/macosx-10.13-x86_64-3.7/cmake-build/3rdparty/ippicv/ippicv_mac/iw
      Lapack:                      YES (/Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Accelerate.framework -lm -ldl)
      Eigen:                       YES (ver 3.3.7)
      Custom HAL:                  NO
      Protobuf:                    build (3.5.1)
  
    OpenCL:                        YES (no extra features)
      Include path:                NO
      Link libraries:              -framework OpenCL
  
    Python 3:
      Interpreter:                 /Users/travis/build/skvark/opencv-python/venv/bin/python (ver 3.7.8)
      Libraries:                   /Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib (ver 3.7.8)
      numpy:                       /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-build-env-0spssg56/overlay/lib/python3.7/site-packages/numpy/core/include (ver 1.14.5)
      install path:                python
  
    Python (for build):            /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
  
    Java:                          
      ant:                         NO
      JNI:                         /Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/JavaVM.framework/Headers /Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/JavaVM.framework/Headers /Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/JavaVM.framework/Headers
      Java wrappers:               NO
      Java tests:                  NO
  
    Install to:                    /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-4jcifzim/_skbuild/macosx-10.13-x86_64-3.7/cmake-install
  -----------------------------------------------------------------
  </code></pre>
  <p>I also tried to create VideoCapture using various apiPreferences, but all of them failed.</p>
  <pre><code>cap=cv2.VideoCapture(0, apiPreference=cv2.CAP_FFMPEG)
  
  cap=cv2.VideoCapture(0, apiPreference=cv2.CAP_GSTREAMER)
  
  cap=cv2.VideoCapture(0, apiPreference=cv2.CAP_V4L2)
  </code></pre>
  <p>Please help me understand why this issue occurs and how to resolve this.</p>