python uploading scripts for youtube

UPDATE:
consider skipping this post and going right to this newer one: https://broadcasterproject.wordpress.com/2010/03/03/howto-youtube-auto-upload-script/

http://code.google.com/apis/youtube/1.0/developers_guide_python.html

many thanks to sean levin for writing the upload scripts.

basic script functionality:

check a folder periodically
if movie file is there: upload it, then move it somewhere else.

that covers the basics. here are some more details.

make softlink for no space version of “Photo\ Booth”
ln -s /Users/yourname/Pictures/photobooth /Users/yourname/Pictures/Photo Booth/
crontab to call shell script periodically.
shell script functionality: check for directory and lock file. make lock file. look for files. call python uploader with file. cp file with new timestamped name. mv file.

now the problems.

1. login problems. i think this has to do with the way that youtube and gmail are now linked in some account. including the edlabbroadcaster account. i made edlabbroadcaster2 that is not linked to google account and that seems to fix log in problems.

2. conversion problems. lots of the videos fail to convert. and some convert to junk like this.

and a static shot of the conversion errors.
youtube conversion errors

tried with some avi files and it works so i’m guessing it’s the .mov format. does built in camera on an imac generate different .mov files than external isight firewire camera on a macmini? that is the question i am pondering.

is there another 3rd party photobooth style software that will write a different format video?

login problems persist as well. would love to move to something other than youtube. it seems youtube gets very confused about login now as accounts are linked to google accounts. so you can’t change password anymore or anything. its really annoying.

UPDATE on login:
so i was working on this today (2009-aug-4) and had several succesful uploads. then 2-3 in a row had login problems with no change to code. then waited 5 minutes and login is fine.

still working on this issue of videos that go grey: http://www.youtube.com/watch?v=UacDMt3hhZY

some question asking on developers forum.
http://groups.google.com/group/youtube-api-gdata/browse_thread/thread/e5f7f73e111162a9#

update:
login issues seem to be mostly fixed now.
conversion errors may have something to do with the filme movement while photbooth is still open. it seems the first of “movei 1.mov” always seems to upload fine. but the next one often has a conversion error. maybe photobooth has some issues with file movement going on while it’s still open? should the files be left in the directory and only moved once a day or something? should photobooth be closed and restarted? is there a photobooth alternative that might work better? use screencapture program like ishowuhd combined with processing or openFrameworks webcam monitor?

Advertisements

Tags: , , , , , , , ,

7 Responses to “python uploading scripts for youtube”

  1. danielpaluska Says:

    if you download the demo version of this software there are sample youtube and blip.tv python upload scripts.
    http://store.shinywhitebox.com/ishowuhd/main.html

  2. danielpaluska Says:

    woulc like to get geotaggin added too
    from here:
    http://code.google.com/apis/youtube/1.0/developers_guide_python.html#DirectUpload

    # prepare a geo.where object to hold the geographical location
    # of where the video was recorded
    where = gdata.geo.Where()
    where.set_location((37.0,-122.0))

  3. danielpaluska Says:

    so you record “movie 1.mov”
    time passes, script is called, “movie 1.mov” become movie_1.mov and is uploaded and moved.
    photobooth is still running. it still has a thumbnail in it’s display for that movie.
    but because it doesn’t exist anymore in the directory, it will name the next recorded movie as “movie 1.mov”
    when the script is called again and this movie is uploaded, it uploads fine but fails to convert. this seems to be pretty consistant now that i am really keeping track.
    then the third version of “movie 1.mov” uploads and becomes a 3 second gray movie. weird but failures continue on any version of “movie 1.mov”. might fail completely or turn out grey but it doesn’t seem to ever succeed again until photobooth is restarted.
    so what to do? keep files around? and keep track of ones already uploaded in a log file? use a different program to create movies? a screen capture program instead?

  4. danielpaluska Says:

    also getting an issue of videos being cut short. this video is viewable but only 2 seconds long when the actual video was much longer.

    to be continued…

  5. danielpaluska Says:

    How to set up a simple broadcaster.

    Files needed:
    videochecker.sh
    uploader2.py

    Accounts needed:
    gmail account
    youtube account

    step 1:
    create a softlink which makes it easier to deal with the space in Photo Booth directory.
    terminal$ ln -s /Users/yournamehere/Pictures/Photo\ Booth/ /Users/yournamehere/Pictures/photobooth

    step 2:
    copy unzipped archive contents to Photo\ Booth directory

    step 3:
    edit usernames, passwords, paths, and developer keys to be the right ones for your accounts
    – if you don’t have a youtube developer key go get one. it’s easy.
    http://code.google.com/apis/youtube/dashboard/gwt/index.html

    step 4:
    terminal$ ./videochecker.sh to try it out.
    be sure you’re ready because it will upload all you movies to youtube.

    step 5:
    set up a cron job to run every so often to call videochecker.sh
    http://benr75.com/pages/using_crontab_mac_os_x_unix_linux

    this requires vi, so open this page too or you will be very frustrated.
    http://www.cs.colostate.edu/helpdocs/vi.html

    http://www.macosxhints.com/article.php?story=2001020700163714
    http://uis.georgetown.edu/software/documentation/macosx1/macosx1.cron.html

  6. Adam Says:

    Thanks for these scripts. I’m having an issue trying to get the videochecker to work. I made the required path modifications (just to a dir where I’m going to put the movies, not photobooth) And made them executable. But when I run, It kicks out with Not Running. It was the 2nd Not Running that exits. Any idea what I’m doing wrong?

  7. danielpaluska Says:

    adam.
    what is the extension on your movie file? the line in videochecker.sh around line 77 or so will be
    for f in *.mov; do
    or for f in *.mp4; do
    or for f in *.ogv; do

    this line will try for three types of files to upload:
    for f in ./*.ogv ./*.mov ./*.mp4;

    see this post too:
    https://broadcasterproject.wordpress.com/2010/03/03/howto-youtube-auto-upload-script/

    you can add additional lines like
    echo “made it to this part of script”
    within the script to see where the error is happening.
    you can also change the
    #! /bin/bash line to be
    #! /bin/bash -ex
    and it will print out more info about exactly where it is when it’s running.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: