1

I'm trying to read some video files that have mp4 format using OpenCV python. I didn't have any problem with any other mp4 video that I have used so far, but for some reason, videocapture cannot read these mp4 video files. My problem is not like this (I already applied this renaming of mmpeg when I first installed opencv). Besides, as I mentioned earlier videocapture can read other mp4 videos, but not these ones. I also tried to convert the video into avi, but still videocapture cannot read the video (I use other avi files with no problem). The videos that I'm using come from this dataset.

Community
  • 1
  • 1
Miranda
  • 565
  • 1
  • 10
  • 27

1 Answers1

5

Do a rewrap using ffmpeg.

ffmpeg -i in.mp4 -c copy out.mp4.

The H.264 bitstream in the source MP4s is Annex B, which is not expected.

Gyan
  • 85,394
  • 9
  • 169
  • 201
  • 1
    Since ffmpeg can read, then opencv should be able to read it in a way. This solution resolved the issue I am facing, thanks a lot, but I guess there should be a resolution other than having to do it manually. Thanks dear – Abdallah Nasir Mar 25 '18 at 12:54