MPEG is an ISO standard movie encoding format. The MPEG converter for MATLAB takes a MATLAB movie matrix and writes the movie to disk as an MPEG file with file extension '.mpg' (MPGWRITE). It also takes an MPEG file and converts it into a MATLAB matrix (MPGREAD).
Acknowledgements
This submission has inspired the following: mmread
As I have try to call mpgread in matlab 6.1,
but I only got the error message
"This is not an MPEG stream."
Please advice what's wrong.
I know that there is a update of mpgwrite,
will there be any update for mpgread ??
Thanks.
06 Oct 2002
Hz Wang
I also met this problem whem I use MATLAB R12. I use
m=mpgread('test.mpg',[1:20],'truecolor');
movie(m)
and I found the background color have been changed! I wondering how to solve this problem or any othe updated mpgread available?
Thanks a lot!
04 Dec 2002
C Harding
The error message "This is not an MPEG stream" can be avioded by stripping the audio stream from the Mpeg first. I use a program called M1 Edit to do this before reading my MPEG into Matlab.
21 Jan 2003
Asia m.
I downloaded the mpgwrite and mpgread from here, but they are empty files -- they only have comments in them. Is it supposed to be like that? Please advice me on this.
Thanx.
19 Mar 2003
Richard Samms
Hey! Works! Using Matlab 5.3/VCC++6.0
Tried all methods of read. Once in, a colormap call and a movie call work. This'll come in handy
04 Apr 2003
J Larsen
There aren't sufficient instructions to get this thing to work. You must have to be a guru in C and Matlab.
I can't read the files, the following message appears:
??? This is not an MPEG stream.
02 Dec 2003
pan lei
I cannot use this function ,my matlab's edition is matlab6.5,but this funciton doesn't work.Who can do me a favor to explain this question??The system always tells me "This is not a mpeg stream"!!!
23 Dec 2003
vimal vimal
give me an example for opening an mpeg file in matlab.
23 Dec 2003
prem prem
give an example for using mpgread and mpgwrite functions in matlab.how to convert mpeg file into frames(no.)
There are a couples of emails sent to me asking for further help on video/audio separation issue, so I think it's helpful to briefly describe it here.
1. download the software - you only need to free demo version
2. Say "file.mpg" is your mpeg file with both video and audio.
3. From "File" menu choose "MPEG tools", then click on "Simple De-multiplexed"
4. Enter "file.mpg" in "Input" edit box, then specify names for your video and audio streams.
5. Click "Run", and that's it
Now your de-multiplexed (only) video file should be able to be called by mpgread function.
08 Mar 2004
Andreas -
Is there another way to get a grayscale frame?
[R G B] = mpgread('my_movie.m1v',1:1); % take frame 1
movie = (R + G + B) / 3; % graysacele it
frame1 = movie(1:567,1:720); % PAL framesize
Andreas
10 Mar 2004
CW Ko
Have anyone encountered such a problem?
I cannot use mpgread at all. but I am sure the file is of MPEG format. So what's wrong?
Here is the message:
>> M = mpgread('d:\Studies\120V_cm_MPEG1.mpg');
??? This is not an MPEG stream.
Error in ==> D:\Matlab_Program\mpgread\mpgread.dll
10 Mar 2004
CW Ko
Hi I've tried to separate video and audio by TMPGEnc. But it still doesn't work and shows: "Segmentation violation" and crashed. My Matlab is R13. Does anyone know how to solve it? Thanks!
13 Apr 2004
ding ding
Is anyone willing to tell me how to use it via Matlab 6.0?
09 Jun 2004
Sudhir Porwal
It is not working properly. It gives error message as "This is not an MPEG file" even if video is in MPEG. It also gives segmentation fault for some video files. It read a single video file successfully but the matrix contains only zeros. Finally, I could not use it. It reads MPEG-1 or MPEG-2 video?
30 Jun 2004
Aimee Monteiro
what do we have to do after downloading the .zip file? we are clueless...
28 Jul 2004
bai hongliang
i can use the mpgread in matlab6.5, release 13. I think many people may meet with the same problem, fistly system gives error message as "This is not an MPEG file" even if video is in MPEG. i solve the problem by changing the video format to MPEG-1 Video.
you can use the Ulead VideoStudio8.
may help to you.
12 Sep 2005
Eugene Pretorius
The mpeg files contain an audio stream. If you remove it using some software encoding program mpgread works just fine
I'think it needs an improvement to support audio + video encoded files for both wide range support and audio/video applications
13 Dec 2005
Hua Zhang
I have separated video and audio by TMPGEnc. Still doesn't work, the error message is "Improper or missing sequence end code in MPEG file" Anyone know how to solve it? Thanks!
13 Aug 2006
Thuy Than
How come it keeps on saying
Error in ==> c:\matlab6p5\mpgread\mpgread.dll
I did compile the file makedll and there is no problem with this. Can anyone give me a hand. Thank your very much for your kindness and have a good day!
08 Jan 2007
Zhijun Wang
Very good
02 Feb 2007
David Zeng
Very Excellent!
12 Mar 2007
insect Z
It's really neat! Is it possible to also put a mpginfo function? Return things like aviinfo?
26 Mar 2007
Balvinder Kaur
Excellent! I am glad to find it on Mathworks site!
03 Jul 2007
Samuel R
It works, just having trouble converting the movie into an width x Height x Length matrix so that I can compare to the uncompressed original data. Any ideas?
06 Sep 2007
john m
Dear all,
how can mpgread be used? The mpgread.m file only contains comments (for the help call), and calling mpgread like described in the documentation:
>> [movie, map] = mpgread('movie.mpg');
results in the error:
??? Attempt to execute SCRIPT mpgread as a function:
../mpgread.m
where .. denotes the path of the mpgread.m file (and all other files in the same dir)
does anybody know how to solve this?
thanks alot,
john
06 Sep 2007
john m
I will answer my own question in order for others to benefit as well.
If you encounter the problems described in my previous post, it is likely that the mpgread mex file for your architecture is missing. for my linux installation, i had to compile the sources in the src/ folder. For this, i had to edit the make file and change cmex into mex (cmex was not found, mex is in the matlab bin folder). after calling make, a file called mpgread.mexglx was produced. i copied this into the mpgread folder and was able to call mpgread() from matlab with success.
best wishes,
john
21 Sep 2007
dee smith
Does anyone know how to read mpeg-2 file using mpgread? MPEG-1 stram works fine, but mpeg-2 stream results in an error:
"Segmentation violation detected at Fri Sep 21 15:59:49 2007 ..............."
I have 7.6.0 matlab version. I'd like to know how I can obtain an mpeg video made also of B-frame. Because using mpgwrite (and then mpgread) I obtain an mpeg video made only of I- and P-frames. Can anyone help me?