Created
November 17, 2017 10:34
-
-
Save t-io/9e743ee070f8d2b693402039b1809174 to your computer and use it in GitHub Desktop.
Revisions
-
t-io created this gist
Nov 17, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ from selenium import webdriver import sys, getopt, time, subprocess, shlex from xvfbwrapper import Xvfb def run(): print('Sreencast website animation') xvfb = Xvfb(width=1280, height=720, colordepth=24) xvfb.start() #browser = webdriver.Chrome() browser = webdriver.Firefox() url = 'https://s3-eu-west-1.amazonaws.com/movefast-quickhost/web-animation-test/index.html' destination = 'movie.flv' browser.get(url) # normal quality, lagging in the first part on the video. filesize ~7MB # ffmpeg_stream = 'ffmpeg -f x11grab -s 1280x720 -r 24 -i :%d+nomouse -c:v libx264 -preset superfast -pix_fmt yuv420p -s 1280x720 -threads 0 -f flv "%s"' % (xvfb.new_display, destination) # high quality, no lagging but huge file size ~50MB ffmpeg_stream = 'ffmpeg -y -r 30 -f x11grab -s 1280x720 -i :%d+nomouse -c:v libx264rgb -crf 15 -preset:v ultrafast -c:a pcm_s16le -af aresample=async=1:first_pts=0 out.mkv' % xvfb.new_display args = shlex.split(ffmpeg_stream) p = subprocess.Popen(args) print(p) time.sleep(30) # record for 30 secs browser.quit() xvfb.stop() if __name__ == "__main__": run()