How to improve resolution?
Generate the output stream with a reasonable pixel-size frameSize
and do not devastate the information quality ( you have stated above to have in the inputs ( in static pixmaps ) ) with a "cummulative product" of low FPS
frames-per-second rate and too-lossy CODEC ( CV_FOURCC
).
SYNTAX:
>>> print cv2.VideoWriter.__doc__
VideoWriter( [ filename,
fourcc, # <--------- ref. below
fps, # 1 fps
frameSize[, # 73 * 59 px
isColor ]
]
) -> <VideoWriter object>
>>> print cv2.cv.FOURCC.__doc__
CV_FOURCC(c1, c2, c3, c4) -> int
>>> cv2.cv.FOURCC( *"XVID" ) 1145656920
>>> cv2.cv.FOURCC( *"MJPG" ) 1196444237
>>> cv2.cv.FOURCC( *"X264" ) 875967064
>>> cv2.cv.FOURCC( *"DIB " ) 541215044
>>> cv2.cv.FOURCC( *"WMV1" ) 827739479
>>> cv2.cv.FOURCC( *"WMV2" ) 844516695
Further readings:
FourCC is a 4-byte code used to specify the video codec.
The list of available codes can be found in fourcc.org.
It is platform dependent.
Following codecs work fine:
In Fedora: DIVX
, XVID
, MJPG
, X264
, WMV1
, WMV2
. ( XVID
is more preferable. MJPG
results in high size video. X264
gives very small size video )
In Windows: DIVX
( more to be tested and added )
FourCC code is passed as cv2.VideoWriter_fourcc('M','J','P','G')
or cv2.VideoWriter_fourcc(*'MJPG)
for MJPG
.
""" # >>> http://docs.opencv.org/master/dd/d43/tutorial_py_video_display.html#gsc.tab=0
fourcc = cv2.cv.FOURCC( *"DIB " )
video = cv2.VideoWriter( 'ATC_LKPR_output.avi', fourcc, 30, size ) # fps = 30, size = ( 1024, 512 )