reading a samsung recorded h.264 video [closed]

asked 2016-09-26 10:12:55 -0500

serycjon gravatar image

updated 2016-09-27 03:27:21 -0500

Hi, I have an issue with reading h264 encoded video recorded by my samsung S5 mini phone camera in OpenCV 3 (on my PC).

I get errors like this:

[h264 @ 0xc5e900] AVC: nal size 555455581 
[h264 @ 0xc5e900] AVC: nal size 555455581
[h264 @ 0xc5e900] no frame!

and lot of visual artifacts on most of the frames. The strange think is, that vlc and mplayer can play the video OK and converting frames to images with ffmpeg works nice as well. Any suggestions how to fix that?

update: As Tetragramm suggested, I have tried to play the video in vlc and look at the statistics. I get no corruptions, but (probably) depending on my current cpu load I get either 0 or quite a lot Lost frames in video section. The visual artifacts are the same as in OpenCV.

So it seems that the video file is not corrupted. The question now is how to read it with OpenCV. I don't need to process it in realtime, so is there a way to read it as slow as necessary not to get lost frames?

From the VLC codec info about the video:

Codec: H264 - MPEG-4 AVC (part 10) (avc1)
Resolution: 1920x1080
Frame rate: 30.009816
Decoded format: Planar 4:2:0 YUV
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-15 11:09:03.260969

Comments

1

In VLC, open the file and click Tools>Codec Information>Statistics tab. Check to see if frames are being corrupted or lost. It's possible that VLC is papering over any errors by interpolating forward and backward as best it can.

Tetragramm gravatar imageTetragramm ( 2016-09-26 20:33:41 -0500 )edit

Thanks for the suggestion. It seems that the video is not corrupted. I have updated my question with the details.

serycjon gravatar imageserycjon ( 2016-09-27 03:28:54 -0500 )edit

Do you have the OpenCV ffmpeg dll? Also, try using the OpenH264 codec and see if that helps. Install instructions are HERE.

Tetragramm gravatar imageTetragramm ( 2016-09-27 17:48:10 -0500 )edit