Generating smaller video file size from frames - matlab

I am doing a project in which I have a video I divide the video into frames and then the image steganography is applied to the frames and the encoded frames are generated. Then the encoded frames are to be converted into video again. All of the methods are applied successfully but the only problem is that I get the encoded video which is very large then the original video. I am using the movie2avi function to generate the video.
Can someone suggest any way to generate the video which is not very large compared to the original video?

First, if you're using movie2avi, you have a limited choice of very poor codecs (compression formats). If you have a new enough version of Matlab (R2009b+ I think) you should be using the VideoWriter class instead. The choice of codecs is still not very good, but they are of much better quality. You didn't indicate which codec (or OS) you're using so I can't recommend an alternative.
Second, even under ideal circumstances you should expect your movie file to get larger with what you're doing unless you apply additional compression. Adding steganographic content is akin to adding noise so you're making the data harder to compress. In both movie2avi and VideoWriter you can adjust the compression level or quality depending on the codec. Also, the default movie2avi codec under Linux and OS X uses no compression so the file will be huge if you haven't changed that.
If VideoWriter doesn't meet your needs (or if your version doesn't have it) you can try my QTWriter class on GitHub that allows one to export QuickTime movies in Matlab. It works very much like VideoWriter, but allows you to create high quality QuickTime movies using a few image-based codecs. No inter-frame compression is used and the PNG and TIFF formats are lossless (this may be important to your steganographic application) while being very efficient at encoding content like that often generated in Matlab. There is also a JPEG format that may be better suited to general images. The QuickTime files can then be converted to other formats if needed. You can read more and see examples here and download the single M-file here.

This is completely dependent on what you are trying to hide in the original video. Remember that the original video is using a compression codec that can take advantage of minimal change frame to frame and various other things, but if you go and try to hide something in that video through steganography, you are making it more difficult for the compression algorithm to do that, which will definitely result in a larger file. So you have to be careful what you are attempting to do, and how you are attempting to encode it.

Related

Video compression for backup purposes

I'd like to know if there is a method/application to further compress MP4 files without loss as compressed files (zip-like) for archival purposes, even if I had to make a bigger file before recompressing.
I don't need to play the videos immediately, it's to have a medium to long term backup, so the zipping/unzipping process wouldn't be an issue for me.
Thanks.
No. The last step in video compression is a lossless entropy encoder similar to zip. What you are asking to do has already been done to the file.

How to find out resolution and count of frames in YUV 4:2:2 file?

How can I determine the resolution and framecount in a YUV 4:2:2 file if I know how many pixels (luma samples) the image contains?
There is a tool to help you to guess the format, give you visual feedback while you trying different parameters.
I'd like to propose to use the excellent tool vooya http://www.offminor.de/
Free for linux usage. Quite cheep for windows.
Many options to specify a raw video format, with instant preview

Split a movie file into audio and video Psychtoolbox

I am working on a project where I have to split a movie file into its basic audio and video parts first. After googling and through documentation and psychdemos in psychtoolbox, I am unable to find even a clue to this issue.
Is there any function in psychtoolbox to split a movie clip like .mpeg or .mov or .avi or .flv into its audio and video parts ?
Please help.
Thanks a lot for your consideration.
First off, it is key to realize that pyschtoolbox is well simply a toolbox. There is a host of other built in MATLAB functions that you can use along with pyschtoolbox.
It looks like even in MATLAB, doing this is a pain in the a$$, but I did find this untested by me FEX entry. http://www.mathworks.com/matlabcentral/fileexchange/8028-mmread
It looks like it should be able to do what you want and it does not depend on purchasing other toolboxes, etc.
By the way, is this a project from elance.com?

standard test videos for video processing

So.. In image processing, lena is the standard image for testing out algorithms in the research community. Similarly.. Are there any standard videos for testing out MATLAB codes for video processing?
There are also commonly used video sequences – though to a degree it depends on the type of video algorithm you're developing (reflected in the level of motion, type of motion, resolution etc.) and the file type you want (e.g. YUV, compressed).
As a starting point, foreman.yuv, Carphone.yuv, akiyo.yuv, bus.yuv, coastguard.yuv, flower.yuv.
For example googling the above turned up a reasonable looking repositories at the following:
YUV Video Sequences – ASU
Derf's Test Video Collection at xiph.org
Lately, the Blender clips Big Buck Bunny, Tears of Steel and Sintel have been more frequently used, as they are available in HD and 4K resolutions as well as in stereo 3D.
/Too long for a comment/
I came across some builtin sample/demo files in a matlab blog post: http://blogs.mathworks.com/loren/2007/01/10/colormap-manipulations/
Apparently the files clown and cameraman are builtin and you can just load them using load clown or load cameraman.
It depends however on the installed toolboxes: clown is from the wavelet toolbox and cameraman from the image processing toolbox. They both can be found on the matlab path of course, so you can always look around there. You'll also there find the files: autumn, board, canoe, cell, circbw, circuit,...
EDIT: also: http://www.mathworks.com/matlabcentral/answers/1376-finding-example-images-in-the-distribution
But for video I personally haven't seen anything like that in matlab
EDIT2:
I stand corrected: in the vision toolbox, there are some example videos, in the visiondemos subdirectory of the toolbox. Just search for avi files on the matlab install directory

How to create quicktime movie from a sequence of images via perl?

I would like to create a quicktime movie from a sequence of still frames via perl. It seems like there should be a relatively simple way to do this, but so far I have not found it. Things I've tried:
Reading the Quicktime file spec and creating the movie file from scratch. This low level approach has worked well for me in the past with TIFF and PDF file formats, but Quicktime seems dauntingly complicated.
Looking at the various quicktime-related perl modules. So far I haven't found one that lets me do what I want (images --> movie) with a minimum of fuss.
Using Applescript and Quicktime Player. This would probably work if I paid for Quicktime Pro, but I'd prefer not to do that.
I'm interested in any suggestions (even non-perl-based ones) for a relatively simple way to assemble a sequence of images into a quicktime movie.
Video encoding isn't really an ideal job for perl -- there are a lot of pieces to put together. I would suggest just using mencoder -- you can use an input of e.g. -mf type=png:fps=30 mf://frame*.png, and an output format of e.g. -of lavf -ovc lavc -lavcopts vcodec=libx264 -o whatever.mov. If you want to dub in audio you can use -audiofile whatever.mp3, and then either -acodec copy if you want it to be MP3 in the movie as well, or perhaps -acodec faac (and -faacopts) if the audio format in the movie needs to be AAC. There are lots of different options to tweak and things to learn but it's pretty much the ideal tool for the job. FFmpeg is nicer to use in a lot of ways, but it doesn't have the mf:// input mode, which makes assembling a video from frames a lot more painful.