Glavin001 / CanvasCast

Cast a Canvas to your Chromecast
MIT License
2 stars 0 forks source link

Initial prototype #1

Open Glavin001 opened 9 years ago

Glavin001 commented 9 years ago
Glavin001 commented 9 years ago

Create a video slideshow from images: https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images

Glavin001 commented 9 years ago

This might work! http://stackoverflow.com/a/13298538/2578205

Ok I got it working. thanks to LordNeckbeard suggestion to use image2pipe. I had to use jpg encoding instead of png because image2pipe with png doesn't work on my verision of ffmpeg. The first script is essentially the same as your question's code except I implemented a simple image creation that just creates images going from black to red. I also added some code to time the execution.

parallel execution (with no images saved to disk)

import Image
from subprocess import Popen, PIPE
fps, duration = 24, 100
p = Popen(['ffmpeg', '-y', '-f', 'image2pipe', '-vcodec', 'mjpeg', '-r', '24', '-i', '-', '-vcodec', 'mpeg4', '-qscale', '5', '-r', '24', 'video.avi'], stdin=PIPE)
for i in range(fps * duration):
    im = Image.new("RGB", (300, 300), (i, 1, 1))
    im.save(p.stdin, 'JPEG')
p.stdin.close()
p.wait()
Glavin001 commented 9 years ago

Also see https://github.com/rrostt/transcode-cast/

Glavin001 commented 9 years ago

Take a read of recording a website with phantomjs and ffmpeg: http://mindthecode.com/recording-a-website-with-phantomjs-and-ffmpeg/

Glavin001 commented 9 years ago

Chromecast can simply run a Canvas in their app's web browser, so this entire project is useless so long as someone builds a Chromecast app. This would be useful if they did not want to build an app and instead use the builtin capabilities, such as video streaming.