0

My desktop OS is Ubuntu 16.04 I am making a video from images using OpenCV videowriter. My image size is x=1920,y=1080 same as my screen size So my image shape is (y,x,3) Everything is correct as per me but I am getting wrong output with just static in it. Could it be an issue with OpenCV itself?

    import numpy as np
    import os
    import cv2
    import tkinter as tk


    window = tk.Tk()
    x = window.winfo_screenwidth()
    y = window.winfo_screenheight()

    video=cv2.VideoWriter('video.avi',cv2.VideoWriter_fourcc('X','V','I',D'),1,(x,y),True)

    files = os.listdir()
    final_files = []
    for f in files:
        if f.endswith('png'):
            final_files.append(f)
        else:
            pass


    for f in final_files:
    img = cv2.imread(f)
    print(img.shape)
    video.write(img)

    video.release()

I am getting static video output

sdasara
  • 97
  • 7
  • 1
    you realize that you missed a quote before the D? `cv2.VideoWriter_fourcc('X','V','I','D')` – MrKioZ May 16 '19 at 08:56
  • The final for loop doesn't look correctly spaced either – GPPK May 16 '19 at 09:50
  • Which version of `opencv` are you using exactly? If possible, go for `opencv4.x.x` instead of `opencv3.x.x`. I have used the video writer in that version on `ubuntu16.04` and it worked for me. – Aditya May 18 '19 at 17:11
  • I’m using opencv 3.4 Python – sdasara May 19 '19 at 20:00

0 Answers0