Convert m2ts to mp4, mp4 to webm, mp4 to ogv using ffmpeg

MP4 TO MP4 (MEDIUM)
ffmpeg -i input.mp4 -b 1000000 output.mp4

M2TS TO MP4
ffmpeg -i input.m2ts -vcodec libx264 -crf 20 -acodec ac3 -vf "yadif" output.mp4

MP4 TO WEBM (HIGH)
ffmpeg -i input.mp4 -aq 5 -ac 2 -qmax 25 -threads 2 output.webm

MP4 TO WEBM (MEDIUM)
ffmpeg -i input.mp4 -aq 5 -ac 2 -qmax 35 -threads 2 output.webm

MP4 TO OGV (HIGH)
ffmpeg -i input.mp4 -vcodec libtheora -acodec libvorbis -q:v 6 -q:a 5 output.ogv

MP4 TO OGV (MEDIUM)
ffmpeg -i input.mp4 -vcodec libtheora -acodec libvorbis -q:v 2 -q:a 4 output.ogv

References
https://gist.github.com/vielhuber/cf918eed2b5cc9eaa63f

Capture Video and Save it using OpenCV Python

cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'XVID') # specify the codec
out=cv2.VideoWriter('output.avi',fourcc,20.0,(640,480))

while True:
    ret, frame = cap.read()
    cv2.imshow("frame", frame)
    out.write(frame)

    # exit video capture
    if cv2.waitKey(1) & 0xFF == ord("q"):
        break

cap.release()
out.release()
cv2.destroyAllWindows()

References
https://www.youtube.com/watch?v=Jvf5y21ZqtQ
https://github.com/mhdr/OpenCV/tree/master/002