MATLAB Answers

How can i read mjpeg video?

4 views (last 30 days)
Siwoo Lee
Siwoo Lee on 6 Jul 2020
Commented: Siwoo Lee on 13 Jul 2020
Hello, I'm struggling with reading mp4 files.
I firstly had an error using VideoReader to read my video file(.mp4). After i downloaded Windows Media Codec, I don't get the error message. But the Numframe is empty.
Filename = 'world.mp4';
vid = VideoReader(Filename)
vid =
VideoReader - 속성 있음:
일반 속성(general):
Name: 'world.mp4'
Path: 'C:\Users\Lee\Desktop\Content\VD\code'
Duration: 180.3010
CurrentTime: 180.3010
NumFrames: <계산 중(calculating)...> 자세히 알아보기
비디오 속성(video):
Width: 1280
Height: 720
FrameRate: 59.9402
BitsPerPixel: 24
VideoFormat: 'RGB24'
So I used
info = mmfileinfo('world.mp4')
and it says that the video format is 'mp4v' and i haven't heared of this.(I guess that this video is Motion JPEG, but i am not sure)
Which code should i use to decode mjpeg video? ( or if i have to use ffmpeg, can you please tell me what should i do?)


Sign in to comment.

Accepted Answer

Chidvi Modala
Chidvi Modala on 13 Jul 2020
'updateTimestamp' is not triggered in Linux which is why isNumFramesAvailable is 0. And that is the reason why NumFrames is always showing 'calculating'
On Linux, computation of timestamps results in frame decoding which might lead to performance regression in few cases. Computation is deferred until timestamps are needed. On Windows and Mac, timestamp generation does not affect performance as no frame decoding is done. Based on platform, appropriate value is passed to VideoReader.

  1 Comment

Siwoo Lee
Siwoo Lee on 13 Jul 2020
thanks for replying. I solved this problem using python :D thank you

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!