Why .mpeg video file does not work when comes to adding noise (Other file formats like .mpg works better ) ?
Show older comments
I have been trying to add noise (Gaussian) to .mpeg video file but error shows up (File is invalid). Pls let me know reasons of using .mpeg , if not, there is other reasons? Psychtoolbox is helpful for adding noises using .mpeg videos?
while hasFrame(Vptr)
%Read from video file
Img = readFrame(Vptr);
%Add noise to the image
Img = imnoise(Img,'gaussian', 0.6);
%write to video file
writeVideo(Wptr,Img);
3 Comments
Dinesh Iyer
on 16 Oct 2018
I am not sure what Wptr is here. I am assuming that it is a VideoWriter object instance.
VideoWriter supports MPEG-4, AVI, MJ2000. Did you call close(Wptr) after you have completed writing all the video frames you wanted?
MPEG-4 file is H.264 encoded. It should give you the best compression for video quality.
Priyanka P
on 16 Oct 2018
Edited: Priyanka P
on 16 Oct 2018
Walter Roberson
on 16 Oct 2018
"By definitation, Vptr = VideoReader(video.mpeg)"
Please confirm that you have a struct named video that has a field named mpeg that contains the name of a file; or else that you have an object of some kind with a property named mpeg that contains the name of a file; or else that you have an object of some kind with a method named mpeg that takes no arguments, and that the method returns the name of a file.
Answers (0)
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!