Skip to content

Instantly share code, notes, and snippets.

@natfarleydev
Last active August 29, 2015 14:22
Show Gist options
  • Save natfarleydev/9f31dd3956653a54999b to your computer and use it in GitHub Desktop.
Save natfarleydev/9f31dd3956653a54999b to your computer and use it in GitHub Desktop.
# To the extent possible, this code is licensed under CC-0
# https://creativecommons.org/publicdomain/zero/1.0/
from moviepy.editor import VideoFileClip
import requests
import os
from vimeo import VimeoClient
ACCESS_TOKEN = # REPLACE WITH REAL ACCESS TOKEN
CLIENT_ID = # REPLACE WITH REAL CLIENT ID
CLIENT_SECRET = # REPLACE WITH CLIENT SECRET
v = VimeoClient(ACCESS_TOKEN, CLIENT_ID, CLIENT_SECRET)
source_video_list = requests.get(
'http://bslparlour.nathanda.co.uk/bslparlour/source_videos/').json()
source_video_list_ogg = []
for i in source_video_list:
if i['mime_type'] == 'video/ogg':
source_video_list_ogg.append(i)
for i in source_video_list_ogg:
print i
clip = VideoFileClip(
'/home/nasfarley88/dropbox/vimeo_drop/'+i['filename'],
audio=False)
clip.write_videofile('/tmp/tmp.mp4', ffmpeg_params=["-qp", "0"])
v.replace(
video_uri='/videos/'+str(i['vimeo_uri']),
filename='/tmp/tmp.mp4',
upgrade_to_1080=False,
)
os.remove('/tmp/tmp.mp4')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment