Bug 1487816

Summary: Cannot read .FLV or .MP4 files
Product: [Fedora] Fedora Reporter: Rares Vernica <rvernica>
Component: opencvAssignee: Nicolas Chauvet (kwizart) <kwizart>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: hhorak, jmlich83, jridky, karlthered, kwizart, matthias, pkajaba, sergio, viktor.vix.jancik
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: opencv-3.2.0-12.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-05 22:51:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rares Vernica 2017-09-02 03:52:27 UTC
Description of problem:

.FLV or .MP4 files cannot be read.


Version-Release number of selected component (if applicable): 3.2.0


How reproducible: always


Steps to Reproduce:

> dnf install opencv opencv-python3
> ipython3
Python 3.6.2 (default, Aug 11 2017, 11:59:59) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import cv2

In [2]: cv2.__version__
Out[2]: '3.2.0'

In [3]: cv2.VideoCapture('big_buck_bunny_720p_5mb.mp4')
(DEBUG) try_init_v4l2 VIDIOC_QUERYCAP "big_buck_bunny_720p_5mb.mp4": Inappropriate ioctl for device
Unable to stop the stream: Inappropriate ioctl for device
Out[3]: <VideoCapture 0x7fcbfc6b2a30>

In [4]: cv2.VideoCapture('big_buck_bunny_720p_5mb.flv')
(DEBUG) try_init_v4l2 VIDIOC_QUERYCAP "big_buck_bunny_720p_5mb.flv": Inappropriate ioctl for device
Unable to stop the stream: Inappropriate ioctl for device
Out[4]: <VideoCapture 0x7fcc0cdc8f70>


Actual results:

(DEBUG) try_init_v4l2 VIDIOC_QUERYCAP: Inappropriate ioctl for device


Expected results:

Open the file and read the frames.


Additional info:

> cat /etc/redhat-release
Fedora release 26 (Twenty Six)

> uname -a
Linux android 4.12.5-300.fc26.x86_64 #1 SMP Mon Aug 7 15:27:25 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

> dnf info opencv
Last metadata expiration check: 0:22:57 ago on Fri 01 Sep 2017 08:25:15 PM PDT.
Installed Packages
Name         : opencv
Version      : 3.2.0
Release      : 2.fc26
Arch         : x86_64
Size         : 10 M
Source       : opencv-3.2.0-2.fc26.src.rpm
Repo         : @System
From repo    : fedora
Summary      : Collection of algorithms for computer vision
URL          : http://opencv.org
License      : BSD
Description  : OpenCV means IntelĀ® Open Source Computer Vision Library. It is a collection of
             : C functions and a few C++ classes that implement some popular Image Processing
             : and Computer Vision algorithms.

Available Packages
Name         : opencv
Version      : 3.2.0
Release      : 2.fc26
Arch         : i686
Size         : 1.6 M
Source       : opencv-3.2.0-2.fc26.src.rpm
Repo         : fedora
Summary      : Collection of algorithms for computer vision
URL          : http://opencv.org
License      : BSD
Description  : OpenCV means IntelĀ® Open Source Computer Vision Library. It is a collection of
             : C functions and a few C++ classes that implement some popular Image Processing
             : and Computer Vision algorithms.

> dnf info opencv-python3
Last metadata expiration check: 0:23:02 ago on Fri 01 Sep 2017 08:25:15 PM PDT.
Installed Packages
Name         : opencv-python3
Version      : 3.2.0
Release      : 2.fc26
Arch         : x86_64
Size         : 2.8 M
Source       : opencv-3.2.0-2.fc26.src.rpm
Repo         : @System
From repo    : fedora
Summary      : Python3 bindings for apps which use OpenCV
URL          : http://opencv.org
License      : BSD
Description  : This package contains Python3 bindings for the OpenCV library.

Comment 1 Sergio Basto 2017-09-02 12:11:00 UTC
After googling I found [1] says to add -DWITH_LIBV4L=ON  to build add support to V4L1 and not just V4L2 [2] , if you could install these packages from [3] and check if it fix and report back  , I could do a official build for F26 .

Thanks.




[1] 
https://github.com/opencv/opencv/issues/6157

[2]
V4L/V4L2:                    Using libv4l1 (ver 1.12.5) / libv4l2 (ver 1.12.5)

[3]
https://copr-be.cloud.fedoraproject.org/results/sergiomb/opencv/fedora-26-x86_64/00597410-opencv/build.log.gz

Comment 2 Rares Vernica 2017-09-02 17:36:07 UTC
Yes it works now. I installed the following packages from [1]:

> dnf install *.rpm
Last metadata expiration check: 0:07:28 ago on Sat 02 Sep 2017 10:12:21 AM PDT.
Dependencies resolved.
================================================================================================
 Package                  Arch            Version                   Repository             Size
================================================================================================
Installing:
 opencv                   x86_64          3.2.0-10.fc26             @commandline          1.6 M
 opencv-contrib           x86_64          3.2.0-10.fc26             @commandline          2.1 M
 opencv-core              x86_64          3.2.0-10.fc26             @commandline          3.6 M
 opencv-python3           x86_64          3.2.0-10.fc26             @commandline          611 k
Installing dependencies:
...


In Python I get some errors/warnings, but the output looks good:

> ipython
Python 3.6.2 (default, Aug 11 2017, 11:59:59) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import cv2

In [2]: cv2.VideoCapture('big_buck_bunny_720p_5mb.mp4')
Failed to query video capabilities: Inappropriate ioctl for device
libv4l2: error getting capabilities: Inappropriate ioctl for device
VIDEOIO ERROR: V4L: device big_buck_bunny_720p_5mb.mp4: Unable to query number of channels
DtsGetHWFeatures: Create File Failed
DtsGetHWFeatures: Create File Failed
Running DIL (3.22.0) Version
DtsDeviceOpen: Opening HW in mode 0
DtsDeviceOpen: Create File Failed
warning: GStreamer: unable to query duration of stream (/builddir/build/BUILD/opencv-3.2.0/modules/videoio/src/cap_gstreamer.cpp:846)
Out[2]: <VideoCapture 0x7fa9bae451d0>


Thanks!


[1] https://copr-be.cloud.fedoraproject.org/results/sergiomb/opencv/fedora-26-x86_64/00597410-opencv/

Comment 3 Fedora Update System 2017-09-02 20:06:15 UTC
opencv-3.2.0-11.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-16c5865d73

Comment 4 Fedora Update System 2017-09-02 21:52:31 UTC
opencv-3.2.0-11.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-8d4865aad2

Comment 5 Fedora Update System 2017-09-03 19:55:39 UTC
opencv-3.2.0-11.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-16c5865d73

Comment 6 Fedora Update System 2017-09-04 06:51:20 UTC
opencv-3.2.0-11.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-8d4865aad2

Comment 7 Fedora Update System 2017-09-14 15:51:08 UTC
opencv-3.2.0-12.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d3648491e8

Comment 8 Fedora Update System 2017-09-15 04:52:31 UTC
opencv-3.2.0-12.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-d3648491e8

Comment 9 Fedora Update System 2017-10-05 22:51:04 UTC
opencv-3.2.0-12.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Matthias 2017-10-11 18:13:00 UTC
I still get this error with the version opencv-3.2.0-12.fc26:

Failed to query video capabilities: Inappropriate ioctl for device
libv4l2: error getting capabilities: Inappropriate ioctl for device
VIDEOIO ERROR: V4L: device ../../Downloads/SampleVideo_1280x720_1mb.mp4: Unable to query number of channels
warning: GStreamer: unable to query duration of stream (/builddir/build/BUILD/opencv-3.2.0/modules/videoio/src/cap_gstreamer.cpp:846)


The links to the COPR repos are dead, are the fixes for this problem really already pushed?

Comment 11 Sergio Basto 2017-10-11 20:42:00 UTC
(In reply to Matthias from comment #10)
> I still get this error with the version opencv-3.2.0-12.fc26:
> 
> Failed to query video capabilities: Inappropriate ioctl for device
> libv4l2: error getting capabilities: Inappropriate ioctl for device
> VIDEOIO ERROR: V4L: device ../../Downloads/SampleVideo_1280x720_1mb.mp4:
> Unable to query number of channels
> warning: GStreamer: unable to query duration of stream
> (/builddir/build/BUILD/opencv-3.2.0/modules/videoio/src/cap_gstreamer.cpp:
> 846)
> 
> 
> The links to the COPR repos are dead, are the fixes for this problem really
> already pushed?

I think it is working , now you just get warnings, before you got a "DtsDeviceOpen: Opening HW in mode 0
DtsDeviceOpen: Create File Failed "