Creating and Uploading a Youtube Video Directly in MATLAB
Youtube released an updated version of their Youtube Data API:
http://code.google.com/apis/youtube/overview.html
It now includes support for uploading new videos. In this example, we show how to create an AVI-file with MATLAB and send it straight to Youtube.
Contents
Create an "Interesting" Picture
set(gcf,'Color','black'); step = .04; [X,Y] = meshgrid(-10:step:10, -10:step:10); surf(X,Y,X.*sin(Y)+Y.*cos(X)-sin(X.*Y)); shading interp colormap(cool) set(gca,'View',[-27 48],'Color','k','proj','p'); grid off set(gca,'xtick',[],'ytick',[],'ztick',[]) axis off vis3d tight l = camlight('headlight');
Animate the Picture and Save It As a Movie
mov = avifile('ripples.avi','quality',100); for i = 1:100 delete(l); l = camlight('headlight'); camdolly(0,0,.02,'fixtarget'), camorbit(1,-.2) mov = addframe(mov,getframe(gcf)); end mov=close(mov);
Upload the Video to Youtube
id = youtubeUpload( ... 'ripples.avi', ... 'X.*sin(Y)+Y.*cos(X)-sin(X.*Y)', ... 'This is the surface X.*sin(Y)+Y.*cos(X)-sin(X.*Y), plotted and visualized with MATLAB.', .... 'Tech', ... {'MATLAB','surface'} ... ); fprintf('After processing, the video will be available at this URL:\n http://www.youtube.com/watch?v=%s',id)
After processing, the video will be available at this URL:
http://www.youtube.com/watch?v=Tsuzfz7_sek
