VideoReader reads ".h264" video compression file with error "Caught unexpected exception of unknown type."

조회 수: 50 (최근 30일)
Initially when I tried to use the VideoReader function to read the ".h264" video compression format file I got the error "Unable to determine the codec required." Then I learned from the Internet that I needed to install the "Media Player Codec Pack" package to read it correctly, so I successfully installed the package from this link, and when I read it again using VideoReader, I got the following error: "Caught unexpected exception of unknown type."
videoPath = "myvideo.h264";
info = mmfileinfo(videoPath)
info =
struct with fields:
Filename: 'myvideo.h264'
Path: 'E:\workDir'
Duration: 0
Audio: [1×1 struct]
Video: [1×1 struct]
info.Video.Format
ans =
'MPEG2'
ENVIRONMENT: Matlab R2022b, windows 10
Note: Since I installed this package, I can play ".h264" files normally with the windows media player that comes with my windows system.
  댓글 수: 2
Walter Roberson
Walter Roberson 2023년 1월 29일
Use a tool such as VLC to determine which codec was used. The codec is a 4 character code (so it is not 'MPEG2' which is 5 characters)
cui,xingxing
cui,xingxing 2023년 1월 30일
@Walter Roberson , I use potplayer to get codec infomation, screenshot is below.
[Filter Usage List]
(1) Built-in Raw Video Source
(2) Built-in Video Codec/Transform
(3) Enhanced Video Renderer(Custom Present)
[Video Information]
Video Encoding: H264 - Built-in FFmpeg decoder (h264, Thread Frame)
Input format: H264 (24 bits)
Input size: 1280 × 960 (1.33:1)
Output format: YV12 (12 bits)
Output size: 1280 × 960 (1.33:1)
Frame rate: 15
BitRate: Unknown
so the codec is 'H264',and then?

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

채택된 답변

cui,xingxing
cui,xingxing 2023년 1월 30일
편집: cui,xingxing 2024년 4월 27일
After much trial and error, I was lucky enough to find a solution that worked for me, and I am sharing it with you so that I can help others.
The prerequisite is to download the ffmpeg audio/video open source tool, download the binary executable for your platform here. I then converted the original video to avi format in the terminal by using the following command, which was subsequently read by matlab properly.
ffmpeg -i myvideo.h264 -vcodec copy test.avi
note: out put video 'test.avi' is same codec as original 'myvideo.h264'
Reference:
-------------------------Off-topic interlude, 2024-------------------------------
I am currently looking for a job in the field of CV algorithm development, based in Shenzhen, Guangdong, China,or a remote support position. I would be very grateful if anyone is willing to offer me a job or make a recommendation. My preliminary resume can be found at: https://cuixing158.github.io/about/ . Thank you!
Email: cuixingxing150@gmail.com

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by