This MATLAB function will send a video directly to YouTube, along with the most important metadata.
1) Download and unzip the GData Java™ Client Library, available at http://code.google.com/p/gdata-java-client/
2) Add the full path to gdata-youtube-1.0.jar to your classpath.txt and restart. Just using JAVAADDPATH doesn't work.
Matthew Simoneau (2021). Upload a Video to YouTube™ (https://www.mathworks.com/matlabcentral/fileexchange/19258-upload-a-video-to-youtube), MATLAB Central File Exchange. Retrieved .
I had major issues with this download. Tried multiple version of the gdata API and emailed the author. I agree with Nathan that the easiest way to do upload from matlab is using GoogleCL. Protip: to upload videos to youtube from matlab as 'unlisted' get the latest version of GoogleCL using SVN. Then you will need to enter the following command in matlab: DOS(python google.py youtube post "filename.avi" --category Tech --access=unlisted --Title "It works!"
I get emailed about this a lot. This code is not so useful. You should install the google command line utility and then do it that way.
Yeah. It can be done. You need to install the google command line utility and all the associated api's. Then you have to enable your youtube account as a developer. Then you can do it.
This guys code is basically useless. I had to do it all myself. The easiest way to do it is through the command line. That way you dont have to modify all the .jar files on the path. Also, it is much faster and matlab is really prone to memory leaks.
Once you get all that stuff setup, which is by no means straightforward. Something like the following should work.
function req_url = im_uploadmovie(game_id,moviedir,game_str)
% im_uploadmovie automatically uploads a game movie to youtube.
% See also im_makemovie
% Version 1.0, 2011-10-21..
movie_file = [moviedir '\movie_game_id_' num2str(game_id) '.mp4'];
commandline_str = ['google youtube post ' ...
'--category Games '....
'--summary "' strrep(game_str,sprintf('\n'),' ') '"'...
' "' movie_file '"'];
[~, results_str] = system(commandline_str);
ind = strfind(results_str,'Video uploaded:');
raw_url = results_str(ind:end);
The problem with this code is in the developerKey, clientid. I think these are expired so you need to register with google API to get your own. I modified the code to allow you to set the privacy settings, and also work for an arbitrary movie type instead just .avi. Send me an email if you want it.
Sheesh. This is a long error message. I am sorry about this. I tried making a new account but I am having trouble with the username and password. I don't understand why it isn't logging in. Do you have ideas why this might be happening? I have checked the username and password several times to verify that they are correct.
Java exception occurred:
com.google.gdata.util.AuthenticationException: Error connecting with login
Caused by: java.io.IOException: The issuer can not be found in the trusted
... 4 more
This looks very useful (for us). However, the latest java is gdata-youtube-2.0.jar. I think this may be why I can't get this function to work. (I get a youtubeservice error).
Urs, don't you know? I'm from the future!
Excellent! Glad to see this. I have tried myself to get a similar function working for uploading MATLAB pics to picasaweb using a similar api from google. But I did not have any luck.
very spiffy, matthew! however, what's MUCH more interesting: the html was published using version 7.7(!) already - whilst the pedestrians just received 7.6...
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!