FRC Youtube Uploader - Instant Match Uploading Tool in Python

Through my experience running live streams in Indiana and PNW over the last 4 years, I have worked to streamline the streaming and archiving process as much as possible. One of the biggest bottlenecks in the process has been the tedious process of uploading matches to YouTube, which consumes at least one volunteer’s day and leaves everybody wondering why a computer can’t do it. For the longest time we have just had someone do it by copying the information from a text file for every form field.

I got fed up with that and have developed a Python tool that automatically uploads videos to youtube with relevant information including playlists, tags, description, and custom thumbnails. The tool is also integrated with TBA to add alliance members and scores to the description, as well as adding videos to the respective matches on the event’s TBA page.

I have been developing this tool for the past few months and after testing at two Indiana events it is time to move to a closed beta test with the goal of a finished product before the 2017 competition season. I am looking for a few events who would be interested in testing the software in the coming weeks. The only requirement is that the event have a method to capture individual match videos and save them to local media. For example, PNW and Indiana use Blackmagic Design’s H.264 Encoder and Media Express to do this because they can specify the filename and automatically increment the match number.

If you would like to participate drop me a PM and we can discuss getting it setup for your event.

Otherwise, feel free to ask questions and look over the code. If anyone has experience packaging for pip let me know cause I could really use some help with that.

Git Repository:

Change log:
V2.1 (October 17th, 2016):
- New extra script to update old descriptions with TBA match info (Thanks to Hallry for giving me the idea).
- Fix bug that was preventing qf4m1, qf4m2, sf2m1, and sf2m2 from being uploaded.

V2.0 (October 16th, 2016):
-Web GUI
-Save form data between uses in case of crashes
-Bug fixes

Example image:

So that’s how you get those uploaded so quickly.

This is a great idea. While I don’t currently stream events, I do record videos of some matches. I can see how a tool like this would be very useful.

I love this idea! I’ll have to talk to the rest of the Georgia AV team about using this.

Thanks for the support. Be sure to let me know when you use it, I want to try to keep track of every event that makes use of it. If you have any special requests to adapt the program for your schema message me and I can fix it up for you.

Nice work, this is a great tool!

When it comes time to add the videos to TBA, you can get write keys for the event by getting in touch and we’ll generate them for you.

Thanks for sharing !
Should this code be integrated into the Blue Alliance website ?

I don’t think any of the code would work like that. It depends on local files, though uploading files is possible with various changes but that would just cause strain on their servers.

Additionally, it is a niche tool within a niche community, I know most people won’t use it, but the people that do will be very happy to be relieved of all the work it does for them.

Neat looking tool, might have to take a look at it for our event.
It reminds me a lot of the FRC Video Splitter tool that got posted a while back (minus the video splitting part) which also had the ability to upload to YouTube automatically

I’m pretty sure FiM coordinated with TBA this past year to format all of the video titles in such a way that TBA could grab them automatically from the FiM YouTube channel. Might be something to ask the TBA admins about.

It was a bit inspired by Ty’s tool, I liked how he put the match data in the description, so I added that in as a feature (as well as a way to retroactively do it to a playlist). But the rest of it was built almost specifically with how PNW (and thus Indiana) setup their titles, descriptions, tags, and such. Especially the part where we upload as the event is happening.

Interesting, I never heard about that. I guess there is the title matching code that could be used to find matches that used the default schema, but I might have to rewrite it to accept TBA’s format for match_codes. Either way I implemented TBA’s trusted API to write the YouTube links immediately which is probably far more efficient.

Yeah, the trusted API is the optimal flow here, because it’s less work on the moderator’s side. However, TBA did implement a feature where you could suggest a YouTube playlist and we’ll do some regex matching on the video titles to auto-import them:

I wrote the regex to be the same as titles generated by Ty’s video splitter, since it was really the only standard out there.

I’m going to try to get this working this weekend for Remix. We’ll let you know if we get it working.

We currently upload after each match but we just do it manually so they normally don’t have the scores in the description, etc.

Will you be using the event wizard to update match scores to TBA? Because I believe that is a requirement to make that part work for off seasons.

If you can’t figure something out or want a specific feature or naming schema let me know, I’ll be open to making changes all weekend.

Yes we always use the event wizard for scores, rankings, and match videos. Thanks for the help, I’ll PM you if we run into any trouble.

This seems really helpful for events. How does it connect to a specific YouTube channel? Does someone have to press submit each time they want to upload a new match or does a script handle this? Is there anything in place to prevent duplicate uploads of the same video?

Hope to try this out at girls gen this weekend.

You can pick any YouTube channel that a Google Account has access to. Google’s OAuth2.0 authentication flow gives you page when you first run the script to pick which channel to upload all videos to.

The program could handle doing that, but I don’t want it to. A measure of human initiation keeps it from unintentionally screwing up. The batch uploading feature does not require human intervention for the set of matches you wish to upload. For example, setting Match Number to 8 and Last Match Number to 12 will upload matches 8, 9, 10, 11, and 12. It will then reset Last Match Number to the default string and update Match Number to Last Match Number + 1, 13 in this case.

There is no way to prevent duplicate uploads other than making sure all your videos are properly named and not using the same settings twice. YouTube only lets a channel know about a duplicate after processing, which the API doesn’t give a response object for.

I have already arranged for the program to be used at Girls Gen. Plus I thought you didn’t do AV.

Quick update for anyone intending on using it this weekend. I promise not to make more updates and cause problems unless there are hot fixes required.

Version 2.4.1 is based on the current commit of master. Grab the latest releases from here:

A bunch of changes have happened since I first posted this thread, so quick change log:

  • Bug fixes for uploading with TBA integration. There still might be problems because I haven’t had time or files to test with.
  • Pick the location of match files (currently only current folder and parent folder with full custom location in the works)
  • Check for file exists before uploading (one problem, the web page still updates if the file doesn’t exist because I never programmed it with this in mind)
  • THREADED UPLOADS, non-blocking web server. Now the webpage updates even faster at the expense of being able to tell when an upload is finished based on the state of the page. Might revert this change based on the responses I get.
  • Speed increases, now only takes about 33 seconds to upload a match once you hit submit (tested over a gigabit connection with a 500MB-700MB files)

If you have any problems during your event, please PM me a screenshot of your console immediately so I can get the problems sorted out.