pythonopencvvideo-processingcodecscikits

How to write low quality video without anti-aliasing?


I have numpy array of grayscale pictures with shape (30,30). The problem is that, when i write it with

cv2.VideoWriter(name + '.avi', cv2.VideoWriter_fourcc(*'FFV1'), fps=24, (30, 30), False)

or

skvideo.io.FFmpegWriter("test.avi", outputdict={'-vcodec': 'libx264', '-crf': '0','-preset':'veryslow'})

My squence of images becomes from that.

raw picture with plt.imshow()

to that:

picture from avi video file opened with vlc with h264 codec

So I want my video without any interpolation.

I know about resizing(for example cv2.INTER_NEAREST), but in this case it is not an option.

How to write raw images in video fromat? Does vlc player affects on video reading?


Solution

  • I used ffv1 lossless intraframe codec with ffmpeg. For example

    cv2.VideoWriter_fourcc(*"FFV1")
    

    Then changed video output module in vlc to Windows gdi, like it was written here