Purpose

Mainly documenting a few things I don't want to forget. Perhaps it's useful to others as well.

If you came here for FISHWORKS (which I'm pretty sure you didn't), click here

måndag 24 oktober 2011

Live screencasting with ffmpeg, ffserver

Put this ffserver.conf file on your server:

 Port 8090  
 RTSPPort 5554  
 BindAddress 0.0.0.0  
 MaxHTTPConnections 500  
 MaxClients 200  
 # 8 Mbits  
 MaxBandwidth 8000  
 CustomLog -  
 NoDaemon  
 <Feed screencast.ffm>  
     File /tmp/screencast.ffm  
     FileMaxSize 30M  
     ACL allow 0.0.0.0 255.255.255.255  
 </Feed>  
 <Stream screencast.swf>  
  Feed screencast.ffm  
  Format swf  
  VideoCodec flv  
  VideoFrameRate 20  
  VideoBufferSize 80000  
  VideoBitRate 768  
  VideoQMin 1  
  VideoQMax 5  
  VideoSize 1376x768  
  PreRoll 0  
  StartSendOnKey  
  AudioBitRate 64  
  AudioChannels 2  
  AudioSampleRate 44100  
  AVOptionAudio flags +global_header  
 </Stream>  
 <Stream status.html>  
     Format status  
     ACL allow localhost  
     ACL allow 192.168.0.0 192.168.255.255  
 </Stream>  
 <Redirect index.html>  
     URL http://www.ffmpeg.org/  
 </Redirect>  

here's a shortcut screencast.sh file, run this on your desktop machine you're screencasting from:
 #!/bin/sh  
 ffmpeg -f x11grab -r 25 -s wxga -i :0.0 -f alsa -ac 2 -ar 44100 \  
  -i hw:PCH,0,0 http://server:8090/screencast.ffm  

Now, simply log on to your server, run ffserver -f ffserver.conf. Then run screencast.sh from your desktop.

You might need to change the input device, you can list them with arecord -l.
Also, replace 'server' with your server address, and check the input dimensions (-s wxga above) and the output dimensions (VideoSize in ffserver.conf) it's a bit tricky and doesn't match the input size to 100%, because the VideoSize dimensions need to be a multiple of 16.

Inga kommentarer:

Skicka en kommentar