Hi Zhiming,
Thanks for your response.
The return value of cap.isOpened was True, and also cap.read() also returns True.
However, this problem is now solved for me.
I understood that codecs were missing on the board to write mp4 video file.
I have added ffmpeg in local.conf file, and compiled the image.
After deploying, opencv was able to detect ffmpeg and now I am able to write mp4 video files.
Thanks