[an error occurred while processing this directive]
glReadPixels
. This can be really fast on some cards/drivers, while slow on some others, unfortunately.glReadPixels
.mibs
.ffmpeg -f rawvideo -s 240x192 -pix_fmt rgb24 -r 7 -i "http://localhost:20000/?fps=7" http://localhost:8090/mpcam.ffm
osg.pigeon.ss
, and FG PLIB is plib.pigeon.ss
/** * * FG Screen Streamer * * Pigeon <pigeon@pigeond.net> * * Streaming FG screen directly over (a very basic) HTTP. * * * Command line arguments: * $ fgfs --screenstreamer=<bind address>,<port> * * * To use the default, which will listen on localhost:20000 * $ fgfs --screenstreamer=, * * * To listen on all interfaces on port 20000: * fgfs --screenstreamer=*, * * * URL query string parameters: * fps=<frame rate per second> * format=rgb|mpjpeg * capturer=gl|osg * w=<width> * h=<height> * scale=1|2|4 * quality=<jpeg quality> (format mpjpeg only) * noflip * * fps: frame rate per second, how many frame it should stream per second, * default is 10. * * format: format of the output stream, which can be: * * rgb - the default if no format given. Raw rgb data. * mpjpeg - multipart jpeg, useful for playback directly on a webpage, also can * be used directly in some video players. Only available if you * compile with SimGear jpeg factory support (which guarantees * libjpeg). * * capturer: gl or osg, osg default if available, otherwise gl. * gl capturer does not allow window resizing during a capture. * Window resizing will terminate any existing streaming. * gl capturer captures at FG window's size only. * osg capturer supports arbitrary capture/stream width and height, * and allows window resizing during streaming. * * w, h: arbitrary width and height, only works with the OSG capturer at the * moment. Ignored with the GL capturer. * * scale: the down scale factor, 1, 2 or 4, default is 1 (not scaled down). * e.g. if FG window size is 800x600, scale=2 gives 400x300 output * frames, scale=4 gives a 200x150 output frames. This is ignored with * the OSG capturer if w and h are specified. * * quality: the jpeg compress quality, for format mpjpeg, default is 75. * * noflip: do not call the flip routine, output image will be inverted, but in * theory faster for FG. * * * URL examples: * http://localhost:20000/?fps=20&format=mpjpeg&scale=2 * http://localhost:20000/?capturer=osg&w=320&h=240 * http://localhost:20000/?capturer=gl&scale=2&noflip * * * Usage examples, assuming FG window size is 800x600. * * Direct playback examples: * * $ ffplay -f rawvideo -pix_fmt rgb24 -s 800x600 "http://localhost:20000/" * * $ ffplay -f rawvideo -pix_fmt rgb24 -s 400x300 * "http://localhost:20000/?fps=20&scale=2" * * $ ffplay -f mjpeg "http://localhost:20000/?scale=2&format=mpjpeg" * * $ mplayer -nocache -demuxer rawvideo * -rawvideo w=800:h=600:format=rgb24:fps=20 http://localhost:20000/?fps=20 * * $ vlc --mjpeg-fps 10 --no-drop-late-frames * "http://localhost:20000/?format=mpjpeg&fps=10" * * (vlc svn 0.9.0 only) * $ vlc --demux rawvid --rawvid-chroma RV24 * --rawvid-width 800 --rawvid-height 600 * --no-drop-late-frames "http://localhost:20000/" * * * Save and playback later (file extension is important for ffplay and mplayer) * * $ wget -O fg.mjpg "http://localhost:20000/?format=mpjpeg&fps=20" * $ ffplay fg.mjpg * $ mplayer -fps 20 fg.mjpg * $ vlc --mjpeg-fps=20 fg.mjpg * * * Save and play at the same time: * $ wget -O - "http://localhost:20000/?fps=20&scale=2&format=mpjpeg" | * tee fg.mjpg | ffplay -f mjpeg - * * * Direct video encoding: * $ ffmpeg -r 20 -f rawvideo -pix_fmt rgb24 -s 400x300 -i * "http://localhost:20000/?fps=20&scale=2" -vcodec mpeg4 * -b 256 -an -vtag DIVX output.avi * * $ mencoder -nocache -demuxer rawvideo * -rawvideo w=640:h=480:fps=25:format=rgb24 * -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=480 * -o output.avi -ffourcc DIVX * "http://localhost:20000/?fps=25&capturer=osg&w=640&h=480" * * * Playing in a webpage directly (only works in Mozilla/Firefox/etc): * Put the following tag in your HTML page * <img src="http://localhost:20000/?format=mpjpeg"> * And you may want to change localhost to something else. * * * Watching, while encoding and streaming over HTTP, with VLC: * * vlc "http://localhost:20000/?fps=10&scale=2" * --no-sout-transcode-hurry-up --no-sout-ffmpeg-hurry-up * --sout-transcode-fps 10 --no-drop-late-frames * --demux rawvid --rawvid-width 400 --rawvid-height 300 --rawvid-fps 10 * --rawvid-chroma RV24 --sout * "#duplicate{dst=display,dst='transcode{vcodec=mp4v,vb=256}: * standard{access=http,mux=asf,dst=0.0.0.0:8080}'}" * * * Notes: * * - Under Linux at least, ffplay/ffmpeg and mplayer/mencoder (-nocache is * important!) seems to work pretty well. vlc also works, but seems to * complain more about late frames every now and then. * * - An output width and height of multiple of 2 is recommended. Hence if * you're using scale=2, you should make sure FG's window width and height * are multiple of 4. And for scale=4, multiple of 8. * * - If you seriously want to capture audio as well, you'll have to record it * from the audio device. Under Linux you can do so with ffmpeg by doing: * $ ffmpeg -r 20 -f rawvideo -pix_fmt rgb24 -s 400x300 -i * "http://localhost:20000/?fps=20&scale=2" -vcodec mpeg4 * -f audio_device -i /dev/dsp -ab 128k -acodec mp3 output.avi * * Note that with this method the video and audio is almost definitely to be * a bit out of sync. * * */