Video Reader: Failed to initialize internal resources

조회 수: 81 (최근 30일)
Robert Daly
Robert Daly 2023년 7월 10일
댓글: Robert Daly 2023년 7월 11일
I am trying to read an MP4 video file from a GoPro camera.
The following error shows up when using VideoReader...
v = VideoReader(fullfile(files(ia).folder,files(ia).name));
Error using VideoReader/initReader
Failed to initialize internal resources.
Error in audiovideo.internal.IVideoReader (line 136)
initReader(obj, fileName, currentTime);
Error in VideoReader (line 104)
obj@audiovideo.internal.IVideoReader(varargin{:});
The video codec is MPEG-H Part2/HEVC (H.265) (hcv1)
The audio codec is MPEG AAC Audio (mp4a)
I looked at the supported formats and notice that they mention "MPEG-4, including H.264".
My guess is that H.265 unsupported? Can anyone confirm?
The audio codec appears to be supported.
The video plays on VLC so I assume I have the codec installed.
I am using Windows 10 Enterprise 22H2, Matlab 2022a
Is there anything that can be done to get VideoReader to work with this file?

채택된 답변

Deep
Deep 2023년 7월 10일
Yeah, it seems that H.265 is unsupported for this. You can use ffmpeg to convert it to H.264 for your task.
ffmpeg -i input.mp4 -vcodec libx264 output.mp4
If you want to do it from MATLAB, there's ffmpeg toolbox. I'd suggest looking into its usage and then using VideoReader on the converted file.
  댓글 수: 1
Robert Daly
Robert Daly 2023년 7월 11일
@Deep thanks for the tip about ffmpeg for changing the codec.
I gave it a test and the file it produced worked as expected with VideoReader.
I had a look at the matlab toolbox but since it seemed I had to download the .exe anyway I just cobbled together a powershell script to run through all of the files.
cd "V:\Video Drops\2023-07-03\GoPro"
$Files = Get-ChildItem -path ".\" -filter *.mp4 -file -ErrorAction silentlycontinue -recurse
foreach ($f in $Files){
& "V:\Instrument Software\Video\ffmpeg-6.0-essentials_build\bin\ffmpeg.exe" -i $f -vcodec libx264 (".\Matlab\"+$f)
}
So far so good...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by