README 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. = Introduction =
  2. _Youtube-upload_ is a command-line script that uploads videos to Youtube. If a video does not comply with Youtube limitations (<15mins for a normal user) you must split it before using ffmpeg or any other tool. _Youtube-upload_ should work on any platform (GNU/Linux, BSD, OS X, Windows, ...) that runs Python.
  3. = Dependencies =
  4. * [http://www.python.org python 2.6 or 2.7]
  5. * [http://code.google.com/p/gdata-python-client python-gdata] (>= 1.2.4)
  6. Note: You must have logged in at least once into your Youtube account prior to uploading any videos.
  7. = Download & Install =
  8. * [http://code.google.com/p/youtube-upload/downloads/list Stable release]:
  9. {{{
  10. $ wget http://youtube-upload.googlecode.com/files/youtube-upload-VERSION.tgz
  11. $ tar xvzf youtube-upload-VERSION.tgz
  12. $ cd youtube-upload-VERSION
  13. $ sudo python setup.py install
  14. }}}
  15. * [http://code.google.com/p/youtube-upload/source/checkout From repository]:
  16. {{{
  17. $ svn checkout http://youtube-upload.googlecode.com/svn/trunk/ youtube-upload
  18. $ cd youtube-upload
  19. $ sudo python setup.py install
  20. }}}
  21. * If you don't want (or you can't) install software on the computer, run it directly from sources:
  22. {{{
  23. $ cd youtube-upload-VERSION
  24. $ python youtube_upload/youtube_upload.py ...
  25. }}}
  26. = Usage examples =
  27. * Upload a video:
  28. {{{
  29. $ youtube-upload --email=myemail@gmail.com --password=mypassword \
  30. --title="A.S. Mutter" --description="A.S. Mutter plays Beethoven" \
  31. --category=Music --keywords="mutter, beethoven" anne_sophie_mutter.flv
  32. www.youtube.com/watch?v=pxzZ-fYjeYs
  33. }}}
  34. * Upload a video with a description from file (_description.txt_):
  35. {{{
  36. $ youtube-upload --email=myemail@gmail.com --password=mypassword \
  37. --title="A.S. Mutter" --description="$(< \description.txt)" \
  38. --category=Music --keywords="mutter, beethoven" anne_sophie_mutter.flv
  39. www.youtube.com/watch?v=pxzZ-fYjeYs
  40. }}}
  41. * Upload the video using the Youtube API:
  42. {{{
  43. $ youtube-upload --api-upload [OTHER OPTIONS] file.flv
  44. }}}
  45. If you set explicitly the {{{--api-upload}}} options or {{{pycurl}}} isn't installed, the original Youtube API will be used to upload the video file. This method is not recommended because it does not shows the nice progressbar.
  46. * Upload a splited video:
  47. {{{
  48. $ youtube-upload [OPTIONS] --title="TITLE" video.part1.avi video.part2.avi
  49. www.youtube.com/watch?v=pxzZ-fYjeYs # title: TITLE [1/2]
  50. www.youtube.com/watch?v=pxzZ-fYsdff # title: TITLE [2/2]
  51. }}}
  52. * Add a video to a playlist:
  53. {{{
  54. $ youtube-upload [OPTIONS] --add-to-playlist=http://gdata.youtube.com/feeds/api/playlists/7986C428284A40A1 http://www.youtube.com/watch?v=Zpqu97l3G1U
  55. }}}
  56. Note that the argument must be the video URL (not a local file) and the playlist is the URL of the feed (with no prefix "PL").
  57. * Get available categories:
  58. {{{
  59. $ youtube-upload --get-categories
  60. Tech Education Animals People Travel Entertainment Howto Sports Autos Music News Games Nonprofit Comedy Film
  61. }}}
  62. * Split a video with _ffmpeg_
  63. Youtube currently limits videos to <2Gb and <15' for almost all users. You can use the Bash example script to split it before uploading:
  64. {{{
  65. $ bash examples/split_video_for_youtube.sh video.avi
  66. video.part1.avi
  67. video.part2.avi
  68. video.part3.avi
  69. }}}
  70. * Upload videos with _curl_
  71. The script uses pycurl by default (when available) to upload the video, but if you need to tweak the upload parameters take a look at the Bash script included with the sources ([http://code.google.com/p/youtube-upload/source/browse/trunk/examples/upload_with_curl.sh examples/upload_with_curl.sh]). This command, for example, would upload _somevideo.flv_ with a limit rate of 100KBytes:
  72. {{{
  73. $ youtube-upload --get-upload-form-info [OPTIONS] | bash examples/upload_with_curl.sh --limit-rate 100k
  74. }}}
  75. * Upload a non-public (private/unlisted) video:
  76. {{{
  77. $ youtube-upload --private ...
  78. }}}
  79. {{{
  80. $ youtube-upload --unlisted ...
  81. }}}
  82. * Get password from standard input
  83. {{{
  84. $ cat password.txt | youtube-upload -p - ....
  85. }}}
  86. * Use a HTTP proxy
  87. Set environment variables *http_proxy* and *https_proxy*:
  88. {{{
  89. $ export http_proxy=http://user:password@host:port
  90. $ export https_proxy=http://user:password@host:port
  91. $ youtube-upload ....
  92. }}}
  93. * Update metadata (title or description).
  94. Set new title for video:
  95. {{{
  96. $ youtube-upload --email=EMAIL --password=PASSWORD --update-metadata --title "new title" www.youtube.com/watch?v=pxzZ-fYjeYs
  97. }}}
  98. = Caveats =
  99. == Validate your credentials ==
  100. Before you upload a video using the script, do it manually to make sure everything is ok (you have a valid user/password and an associated channel). See issue57 for more details.
  101. == Using two-step verification ==
  102. If you are using [https://support.google.com/accounts/answer/180744?hl=en two-step verification] issue an application-specific password and use it in the script as if it was your real password. See [https://code.google.com/p/youtube-upload/issues/detail?id=111 issue111] for more details.
  103. == Sign in using App Passwords ==
  104. An App password is a 16-digit passcode that gives an app or device permission to access your Google Account. If you use 2-Step-Verification and are seeing a “password incorrect” error when trying to access your Google Account, an App password may solve the problem.
  105. https://support.google.com/accounts/answer/185833?hl=en
  106. == Progressbar ==
  107. You need both packages *python-progressbar* and *pycurl* installed to see the progress bar when uploading a video.
  108. = Feedback =
  109. Use the [http://code.google.com/p/youtube-upload/issues/ issues tracker] to report bugs or suggest improvements.