fourcc = cv2.cv.CV_FOURCC(*\'XVID\')
The above line is used for avi video. In the same fashion, which codec do we use for mp4 videos in Ubuntu?
I had to reinstall ffmpeg and compile opencv from source in order to get this working. I documented the steps in this blog post.