You can also use other videoWriter fourccs' which change the encoding methods, i.e, it can solve your file not supported errors. Just replace 'mp4v' with the fourcc you want, you can get a list of the available fourccs by putting -1 in place of 'video_fourcc' in videoWritter(). opencv documentation: docs.opencv.org/4.x/dd/d9e/classcv_1_1VideoWriter.html to get a full list of all the fourccs you can get them from the links provided in the documentation, you can get what fourccs works for you from the 3 websites provided.
I extracted frame from .mp4 video that output frame are so many, but when I convert this extracted frame to get original video, some image frames intercepted between another frames in the combining video. how to solve this problem??
this code adds the images one by one from the starting of the list. so, the intervened frames maybe are in the wrong place in the list. try renaming the frames serialy and sort the list accordingly it may help
Basically add the image multiple times for eg if you want a img to be there for 2 secs and your frame rate is 24 fps add the img 48 times consecutively, you can use a for loop for this
In your video you have 3 different groups of image sequences that have to be converted into 3 different video files. Have you developed a way to convert the 3 different groups of image sequences into 3 separate videos by only running the code once? Or did you have to run the code 3 separate times for each project?
i ran it 3 separate times as I don't use it much but you can put the code in a function and run it in a for loop, giving the separate image sequences as a input for the function in each iteration of the code.
For example if you want to add a transition image after the 10th frame, you can check which frame it is currently writing to the video every time a new frame is written and when it hits the 10th frame it will add the transition image.This can be done by adding this code at the end of the last for loop. if(i+1==10): video.write(cv2.imread(transition image path)
Some video players do not support the videos outputed with this method, vlc media player is compatible. I'm working on a solution for this issue. But one work around would be to convert the video using vlc, you can see other videos on how to convert.
It depends on which codecs you have on your PC, you can try putting -1 in the videowriter fourcc to get which codecs you have on your PC. You can try those codes one by one and see which one works the best. answers.opencv.org/question/100967/codecs-list/