Ask Your Question

John_Mdo's profile - activity

2015-12-28 04:14:05 -0600 commented question Unable to save a video file (encoder not found)

@LBerger I installed cisco encoder but I don't see any change in application behaviour @LorenaGdL Ok, thanks for the info, I still have issue opening avi file I'll post the error message if I find a way to get it

2015-12-24 10:12:08 -0600 commented question Unable to save a video file (encoder not found)

thx, i'll test it and edit my post if it work

2015-12-24 09:04:39 -0600 commented question Unable to save a video file (encoder not found)

Thx again, indeed it's working with PIM1 and .avi so that's that

but now how do I make it work with ACV1 and .mp4

2015-12-24 06:31:37 -0600 commented question Unable to save a video file (encoder not found)

thank's for your answer

I get this error now : MPEG1/2 does not support 12/1 fps

Just to see what happens when i change the fps to 20 24 or 30

i get this error Tag PIM1/0x314d4950 incompatible with outpout codec id '1' (j[0][0][0])

by the way I get the FPS from my source file and I'd like to create a file with the same properties

2015-12-23 11:07:02 -0600 commented question Unable to save a video file (encoder not found)

thx but it doesn't this post is in C++ and as I said, i'm not really comfortable translating something from one language to the other , yet

2015-12-23 08:32:25 -0600 received badge  Organizer (source)
2015-12-23 03:30:14 -0600 received badge  Editor (source)
2015-12-23 03:29:07 -0600 asked a question Unable to save a video file (encoder not found)

Hi everyone, first time here so please be gentle ;) Here it goes

I try to open a video file, do some detection inside, draw contours and then save everything in a new file with the same properties , everything works as intended except the creating and writing in a new file part

I tried to set the fourcc manualy by using H264 MPG4 ..., but I always get this error : encoder not found

When I use

out.isOpened()
it's always False so I have no idea what I do wrong here but I really can't find a wait to create a new file I tried -1 so I can choose from available codec but I don't get any choice

I don't get it, if I can open my source video file doesn't it mean that I got the right codec for it ?

Originally I intended to use cv2.CAP_PROP_XXXX to get the properties from my file and use this information to create my new file, and thus use the same codec to open my first file and write my second. After reading and trying , a lot, i'm stuck with a FOURCC in double format and I really don't know how to convert it in char format

fps = int(cap.get(cv2.CAP_PROP_FPS))
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fourcc = cap.get(cv2.CAP_PROP_FOURCC)

out = cv2.VideoWriter('C:\Users\John\Desktop\Test\output.mp4',fourcc, fps, (width,height))

I found two way to do this in C++ unfortunately I'm not experienced enough to figure out how to do this in python

EDIT : it seems I am now

 char EXT[] = {ex & 0XFF , (ex & 0XFF00) >> 8,(ex & 0XFF0000) >> 16,(ex & 0XFF000000) >> 24, 0};
union { int v; char c[5];} uEx ;
uEx.v = ex;                              // From Int to char via union
uEx.c[4]='\0';

anyway i'm stuck and i need some help

EDIT : I continued to search and try , here what I got so far, I did it step by step so I could see what was happening

fourcc = cap.get(cv2.CAP_PROP_FOURCC)

fourcc is a float and has a value of 828601953.0

fourcc= int(fourcc)

now fourcc is an int an has a value of 828601953

fourcc = chr((fourcc & 0XFF)) + chr((fourcc & 0XFF00) >> 8)+ chr((fourcc & 0XFF0000) >> 16)+ chr((fourcc & 0XFF000000) >> 24) + chr(0)

now fourcc is a string of 5 char 'a' 'v' 'c' '1' '\0'

fourcc = cv2.VideoWriter_fourcc(fourcc[0],fourcc[1],fourcc[2],fourcc[3])

now fourcc is an int again with the value 828601953

in the end what I have found out is that cv2.VideoWriter_fourcc() doesn't need maj charactere to work and the second is that I don't have to change my fourcc in a string to use it and I can simplify my code

from this:

fourcc = cap.get(cv2.CAP_PROP_FOURCC)

fourcc = int(fourcc)

fourcc = chr((fourcc & 0XFF)) + chr((fourcc & 0XFF00) >> 8)+ chr((fourcc & 0XFF0000) >> 16)+ chr((fourcc & 0XFF000000) >> 24) + '\0 ...
(more)