I have written a python script to upload my YouTube videos. I tested it on a smaller file and it all works fine. However, when I try to upload larger files I have noticed that it is extrememly slow compared to using the YouTube UI(around 10x). I have Gigabit internet and get around 600-700 Mbps upload when using the YouTube UI and around 45 Mpbs when I use my script. I have verified this by uploading the same video with my script and the UI and checking my network send rate in Task Manager.
MBs = 100 * 1024 * 1024 # The Default Setting in the Python APImedia = MediaFileUpload(file_path, chunksize=MBs, resumable=True)request_body = {'snippet': {'title': title,'description': description,'categoryId': '20' # Gaming },'status': {'privacyStatus': 'private', # Set the video as private initially'publishAt': premiere_date, # Premiere date in ISO 8601 format'selfDeclaredMadeForKids': False # Set this according to your video's audience }}# Insert videoupload_request = service.videos().insert( part='snippet,status', body=request_body, media_body=media)I have tried various chunksize settings here and it appears to respect the size of chunk, but the speed is just really slow compared to the UI. Has anyone figured out a way to make this more performant?
I have read the documentation and it says Google App Engine is limited to 5MB but this is running on my machine. I have also tried setting chunksize as a multiple of 256KB and it has the same performance. I feel like I'm missing a setting somehwere.