Skip to content

Instantly share code, notes, and snippets.

@xoan
Created November 25, 2010 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xoan/b66ed5c787dd09113ee5 to your computer and use it in GitHub Desktop.
Save xoan/b66ed5c787dd09113ee5 to your computer and use it in GitHub Desktop.
Cineforiano Live

Live Show Script

Requisites

Install flashcam (in order to provide vloopback)

$ wget -c http://www.swift-tools.net/Flashcam/flashcam-1.4.5.tgz
$ tar xfzv flashcam-1.4.5.tgz
$ cd flashcam-1.4.5
$ make
$ sudo make install

Install webcamstudio (in order to provide a `lazy' video input)

$ wget http://sourceforge.net/projects/webcamstudio/files/WebcamStudio4Linux/0.56/webcamstudio_0.56_all.deb/download
$ sudo gbedi webcamstudio_0.56_all.deb

Install mjpegtools_yuv_to_v4l (in order to pipe ffmpeg output to video input)

$ wget http://panteltje.com/panteltje/mcamip/mjpegtools_yuv_to_v4l-0.2.tgz
$ tar xfzv mjpegtools_yuv_to_v4l-0.2.tgz
$ cd mjpegtools_yuv_to_v4l-0.2
$ make
$ sudo make install

Stop/Start fcinit (vloopback) and webcamstudio (in order to asign /dev/video[1|2] to vloopback and /dev/video[3|4] to webcamstudio)

$ sudo /etc/init.d/webcamstudio stop
$ sudo /etc/init.d/fcinit restart
$ sudo /etc/init.d/webcamstudio start

Draft mode

Start X

[tty1] $ startx -- :0.0
[tty2] $ startx -- :1.0

Change DISPLAY :1.0 resolution to 640x480

$ xrandr -d :1.0 -s 640x480

Grab DISPLAY :1.0 and send to vloopback

$ ffmpeg -f x11grab -s 640x480 -r 5 \
  -i :1.0 -pix_fmt yuv420p -s 320x240 -r 5 -f yuv4mpegpipe -an - | \
  mjpegtools_yuv_to_v4l /dev/video2

Start mplayer in :1.0

$ mplayer -vo gl2 -display :1.0 -fs /path/to/file

Clean mode

Initial situation

Start grabbing DISPLAY :1.0 to fill USTREAM stream.

LVDS1 primary left, VGA1 (640x480) right at DISPLAY :0.0

chvt N (ttyN with DISPLAY :1.0) and xrandr --same-as (man xrandr)

sleep

$ ./cineforiano.sh

xrandr VGA1 --right-of LVDS1 (man xrandr again :) and chvt (DISPLAY :0.0)

Webcam/Mic to USTREAM

Clap! Clap!

#!/bin/bash
#TODO: xrandr stuff
DISPLAY=":1.0"
MAIN_IMG='/home/xoan/cineforiano.png'
feh --bg-scale $MAIN_IMG
sleep 3
for file in /media/LACIE/04/Escritorio/cineforiano-5aniversario/shortfilms/shortfilm_01_0*.mpg
do
sleep 2
title=${file##*/}
feh --bg-scale /home/xoan/${title%.*}.png
sleep 5
mplayer -vo gl2 $file
feh --bg-scale $MAIN_IMG
done
echo "Thanks for watching"
#TODO: xrandr stuff
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment