1

I try to read a 4k video in Matlab. I use the next code:

vision.VideoFileReader('my_file.mp4', ...
                              'ImageColorSpace', 'RGB', ...
                              'VideoOutputDataType', 'uint8');

The video file is obtained from GoPro camera and the MPEG-4 H264 codec is used to compress the video. The resolution of each frame is 3840 x 2160 pixels, so it is indeed the 4k UHD video. I got the next error:

Error using coder.internal.errorIf (line 9)
Unable to read video from the file. Use dsp.AudioFileReader to read audio content.
Error in vision.VideoFileReader/setFileInfoProps (line 352)
Error in vision.VideoFileReader/set.Filename (line 150)
Error in matlab.system.SystemProp/parseInputs (line 908)
Error in matlab.system.SystemProp/sysObjSetProperties (line 298)
Error in vision.VideoFileReader (line 133)

The video from the same camera (meaning the same codec), but using resolution 1920 x 1080 pixels,can be read without any errors.

I use Matlab R2014b (64-bit), Windows 7 Professional.

Any ideas how I can read the 4k video without converting it to different format?

Dima
  • 38,860
  • 14
  • 75
  • 115
  • 1
    This doesn't answer your question, but I wouldn't use MATLAB to process GoPro video. There is better software for that and it's easier to use. – rayryeng Jun 01 '15 at 15:25
  • Looks like the error might have something to do with the audio. Do you really need to read in audio too? Have you tried just using the `VideoReader` class? Does the same error occur for every 4K file? Also, are you really sure it's the same codec (audio and video)? You might check this in a different application. – horchler Jun 01 '15 at 22:43

1 Answers1

1

Cathrine, This system object uses Windows API's such as DirectShow or Media Foundation to read videos. Are you able to play this video using Windows Media Player? If not, then it will not work in MATLAB.

I do not believe Windows ships codecs for 4K videos by default. You can try: https://www.mediaplayercodecpack.com/

and then give it a shot. After installing these codecs if you are able to playback using Media Player but still fails with vision.VideoFileReader or VideoReader, then you should probably contact tech support.

Dinesh Iyer
  • 681
  • 3
  • 11