MATLAB: Does not the video working from ffmpeg in matlab

ffmpegvideo processing

I encoding video with program HandBrake. Then I read this video in Matlab and everything works properly. I encoding video with program ffmpeg. Matlab reads only black frames. Both encoders are h.264 (mp4). Both videos play fine in VLC.
ffmpeg code:
ffmpeg -i Barrier.avi -c:v libx264 -b:v 500k outputt5.mp4

Best Answer

Use the video filter for making sure that your output is in YUV420 format (in FFMPEG: -vf format=yuv420p). When you use the yuv444 or yuv422 formats then MATLAB is unable to read the videos properly.
FYI: Did this on MATLAB 2016b and 2017b.
Hope it helps!
Related Question