OpenCV: h264 error while decoding

[h264 @ 0x7ff272872000] error while decoding MB 119 13, bytestream -54 [h264 @ 0x7ff272867200] error while decoding MB 8 27, bytestream -5

brew install gst-plugins-bad gst-plugins-ugly gst-plugins-good

Try rebuilding OpenCV without FFMPEG support, but with GStreamer enabled. Then, ensure you have all of the GStreamer plugins installed (good, bad, ugly) and gstreamer-ffmpeg (if you're in Linux, not sure how to get these plugins/libraries in other OSes).

I had the same problem with OpenCV 2.4.9 on Ubuntu 14.04, built with FFMPEG enabled. I tried the FFMPEG library versions in the Ubuntu repository (libavcodec 54.35.0, libavdevice 53.2.0, libavfilter 3.3.0, libavformat 54.20.4, libavutil 52.3.0, libavresample 1.0.1). I also tried with the latest FFMPEG libraries manually compiled with libx264 support, but was still seeing these same h264 decoding failures in my RTSP H264 stream (from an AXIS video encoder). However, I just rebuilt OpenCV without FFMPEG support and the H264 decoding errors have disappeared.