Ask Your Question

Woody247's profile - activity

2018-09-30 22:24:53 -0500 received badge  Famous Question (source)
2016-07-29 08:36:54 -0500 received badge  Notable Question (source)
2016-02-03 23:40:42 -0500 received badge  Popular Question (source)
2015-02-14 08:31:26 -0500 received badge  Editor (source)
2015-02-14 08:29:03 -0500 asked a question warning: Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:545) python cmd call

Hi guys,

I am getting this error when running the following code through LabVIEW which is interacting with Python through the cmd line.

import cv2   
import sys

#argv 0 = This py code   
cap = cv2.VideoCapture(sys.argv[1])  
print sys.argv[1]   
new = sys.argv[2]   
print new  

if cap.grab() == True:
    fourcc ='C','V','I','D')

    fps = int(cap.get(5))
    width = int(cap.get(3))
    height = int(cap.get(4)) 

    out = cv2.VideoWriter(new,fourcc, fps, (width,height))

    delay = int(1000/fps)#delay in s

    num = int(cap.get(7)) #number of frames
    z = float(0.0)

    for k in range(1,num):
        ret, frame =

        z += 1
        percent = float((z/num)*100)
        out.write(frame)#write flipped frame

        print percent


I am calling it using a LabVIEW code but effectively I'm just giving a filename to convert from mp4 to AVI.

Any help appreciated.