opencv无法停止流:设备的不适当的ioctl [英] opencv Unable to stop the stream: Inappropriate ioctl for device
本文介绍了opencv无法停止流:设备的不适当的ioctl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想将视频转换为帧图像.
I just want to convert video to frame images.
使用此简单代码
import cv2
vidcap = cv2.VideoCapture('gog.mp4')
success,image = vidcap.read()
count = 0
success = True
while success:
success,image = vidcap.read()
print 'Read a new frame: ', success
cv2.imwrite("frame%d.jpg" % count, image)
count += 1
输出是
无法停止流:设备的ioctl不适当
Unable to stop the stream: Inappropriate ioctl for device
我正在ubuntu服务器上使用python 2.7.6.
I am using python 2.7.6 on ubuntu server.
推荐答案
我已经在Ubuntu 16.04.3.上解决了此问题.
I have solved this issue on Ubuntu 16.04.3.
-
sudo apt-get install ffmpeg
-
sudo apt-get install libavcodec-dev libavformat-dev libavdevice-dev
-
使用以下命令重建OpenCV 3.3.0:
sudo apt-get install ffmpeg
sudo apt-get install libavcodec-dev libavformat-dev libavdevice-dev
Rebuild OpenCV 3.3.0 with the following commands:
-
cd build
-
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_FFMPEG=ON -D WITH_TBB=ON -D WITH_GTK=ON -D WITH_V4L=ON -D WITH_OPENGL=ON -D WITH_CUBLAS=ON -DWITH_QT=OFF -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" ..
-
make -j7
-
sudo make install
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_FFMPEG=ON -D WITH_TBB=ON -D WITH_GTK=ON -D WITH_V4L=ON -D WITH_OPENGL=ON -D WITH_CUBLAS=ON -DWITH_QT=OFF -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" ..
make -j7
sudo make install
这篇关于opencv无法停止流:设备的不适当的ioctl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文