unable to write mp4 video using opencv

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

unable to write mp4 video using opencv

1,390 次查看
john_wick
Contributor II

I am trying to write a mp4 video file on imx8m mini using opencv library. I am using ov5647 camera module.

Below is the code I am using to write video.

john_wick_0-1613735479372.png

However, after I run this program, there is not test.mp4 file created at all. 
I have also tried fourcc's *H264 also, but the result is same.

Please suggest. Thanks in advance.

标签 (1)
0 项奖励
回复
2 回复数

1,366 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi

 

You must add return value judgment as you don't know if the camera has been opened.

Can you provide the log when you run this test?

 

BR

Zhiming

0 项奖励
回复

1,351 次查看
john_wick
Contributor II

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