Split a movie file into audio and video Psychtoolbox - matlab

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?

Related

How to change aurioTouch project to write recordings to .caff or .wav file

I'm investigating aurioTouch2 sample code.
I wanna change smth to record audio from microphone and to write these data to .caff or .wav file. So later I will be able to play this audio with AVAudioPlayer.
My idea is to use AVAudioRecorder in applicationDidFinishLaunching, but may be it's not the best solution or may be even it's not possible by this way (I've not tried to use AVAudioRecorder, because I think that most likely it's not the best idea).
I've tried to write byte data in
void FFTBufferManager::GrabAudioData(AudioBufferList *inBL)
{
memcpy(mAudioBuffer+mAudioBufferCurrentIndex, inBL->mBuffers[0].mData, bytesToCopy);
// after this I copy to my own buffer and collect all the data during 30 seconds
}
So as you see, I copy to my own buffer and collect all the data during 30 seconds. Than I write data to .caff file. That doesn't work.
Update:
Or may be the way of playing binary data of audio (not encoded to .waf or .caff audio) exist?
There's a few different ways to do this. One approach is to use ExtAudioFileWriteAsync.
Apple provide a sample project that demonstrates how to do this. It's RecordAudioToFile.
Have a look at some other posts as well, e.g. Can anybody help me in recording iPhone output sound through Audio Unit
I am not sure if I got you correctly but you can't just write the buffer to disk. CAF and WAV files need their own headers and encoding of the audio data. The AVRecorder class does this for you. There are plenty of questions on this topic. See for example this question.

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

Record audio, add effects, then save result to a audio file

I am having trouble doing what the title said. My goal is to be able to add any desired effects to your recording, save the modified audio, then send that to a server.
I have searched the fourms and came across these threads:
viewtopic.php?f=7&t=13029&p=45362&hilit=saving#p45362
viewtopic.php?f=7&t=12660&p=44586&hilit=saving#p44586
viewtopic.php?f=7&t=13178&p=45746&hilit=saving#p45746
After reading those, I see it is possible to save the modified audio, but can it only be saved as a wav? Like I said after it is saved it will be sent to a server, so size is a big deal and wavs are relatively big compared to other formats. Ignoring that fact, I tried to implement FMOD_OUTPUTTYPE_WAVWRITER and I cannot get that to work; are there any good examples of using it? I looked though the examples in the library but I didn't see any..
But the basic structure of the app is to record, turn some switches off and on to see what filters you want, preview it, then press a button "Save" that will save it. What would this save function consist of?
Any help appreciated, thanks.
Using FMOD_OUTPUTTYPE_WAVWRITER is fairly straight forward, you set the type via System::setOutput, specify the output file via System::init extradriverdata. The extradriverdata should be an absolute path to a writable area of the device such as the documents directory. After you have finished playing, call System::release and the file will be complete.
The other option for recording wave data with effects is by creating a custom DSP and connecting it to the channel playing the recorded data. You will then get regular callbacks giving you float data that you must write out to disk yourself. You can find examples of DSPs and writing wav files in the dsp_custom and recordtodisk examples respectively.
Finally note that FMOD doesn't come with the facility to write compressed audio to disk, you will need another API to achieve this goal.
You can save as an AAC file via the ExtAudioFile API.

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.

rendering a waveform on an iphone

I was wondering if anyone has any suggestions on how to go about rendering a waveform of an audio file. I wold like to enable the user to set an in and out point of an audio track and I need to have a waveform so you can see where to put the points.
Are there any libraries available for this or does it need to be a completely custom solution?
Is it even called a waveform ? Maybe there's a better word for it so I can do some more searching.
TIA !
I'm reposting my answer from this question, since it applies here as well:
When displaying an audio waveform, you will want to do some sort of data reduction on the original data, because there is usually more data available in an audio file than pixels on the screen. Most audio editors build a separate file (called a peak file or overview file) which stores a subset of the audio data (usually the peaks and valleys of a waveform) for use at different zoom levels. Then as you zoom in past a certain point you start referencing the raw audio data itself.
Here are some good articles on this:
Waveform Display
As far as source code goes, I would recommend looking through the Audacity source code. Audacity's waveform display is pretty good and mostly likely does a similar sort of data reduction when rendering the waveforms.
CorePlot is the library you are looking for. It is hosted on Google code.
See this related SO question.
I realise this is an old post, however i searched for this recently, and decided to roll my own solution based on a few snippets i located on SO and a few other sites.
See my answer to This question