Open main menu

Wikibooks β

Puredyne/Stream Audio and Video

< Puredyne





Liquid SoapEdit



run this once:

mkfifo stream.ogv

then to stream run these two lines:

dvgrab - | ffmpeg2theora -f dv -x 352 -y 288 -v 7 -o stream.ogv - &
cat stream.ogv | oggfwd 8000 password /stream.ogv

adjust size and quality (-v) down if encoding is slower than realtime and your cpu core is maxed out. go up with them if your cpu is not loaded above 50% and video is fluid but ugly. if the encoding cannot keep up with real time, you will have drops in the stream. watch the second timers in the shell - they should both be at almost the same values.




You can stream online your video: FreeJ encodes using the Ogg/Theora codec and broadcasts to an Icecast server.

When streaming also an audio channel, you need to run also a Jack daemon and connect it to the FreeJ outputs.

While streaming, is also possible to save a local copy of the video, all realtime. Here below a script example:

// Audio input is taken via Jack from other applications running

// port name buffer size samlerate

audio = new AudioJack("alsaplayer", 2048, 44100);

// tweak the values below accordingly, see Jack documentation

// Create a Video Encoder object

// values 1-100 video quality video bitrate audio quality audio_bitrate

encoder = new VideoEncoder(10, 64000, 0, 24000);

// Add the audio channel in the video encoded


// Configure the encoder to stream over an Icecast server



encoder.stream_title("testing new freej");




// Register the encoder on the running FreeJ engine


// Start a network stream


// Record the stream into a local file


We can paste the above code into a script and run it with freej -j stream.js

Besides tweaking this scripts for various accounts it is also possible to include it as part of a bigger FreeJ script, to mix multiple sources with text and effects and even control it from a MIDI, OSC or Joysticks...


for a sound only queue :

gst-launch-0.10 alsasrc ! audio/x-raw-int,rate=44100,channels=2,depth=16 ! queue ! audioconvert ! vorbisenc quality=0.8 ! oggmux ! tee name=tt \
! queue ! filesink location=artsbirthday-day3-$datenum.ogg tt. ! queue ! shout2send ip=x.x.x.x port=8000 password=mypass mount=mount.ogg

for a firewire video :

gst-launch-0.10 videomixer name=mix ! ffmpegcolorspace ! video/x-raw-yuv ! queue ! theoraenc quality=32 name=venc \
  oggmux name=mux ! tee name=tt ! queue ! filesink location=streamfile.ogg \
  tt. ! queue ! shout2send mount=/stream.ogg port=8000 password=xxx ip=xxx \
  alsasrc ! queue ! audioconvert ! vorbisenc name=aenc aenc. ! mux. \
  venc. ! mux. \
  dv1394src do-timestamp=true typefind=true ! queue ! dvdemux ! dvdec ! queue ! videorate ! videoscale ! ffmpegcolorspace ! video/x-raw-yuv, width=352, height=288,framerate=15/1 ! videobox left=0 top=0 border-alpha=0 ! mix.


gst-launch-0.10 v4l2src device=/dev/video0 ! video/x-raw-yuv,width=320,height=240 ! queue ! videorate ! video/x-raw-yuv,framerate=25/2 \ 
! videoscale ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! tee name=tscreen ! queue ! autovideosink tscreen. ! queue \
! theoraenc quality=16 ! queue ! oggmux name=mux osssrc device=/dev/dsp ! audio/x-raw-int,rate=22050,channels=1 ! queue ! audioconvert z \
! vorbisenc quality=0.2 ! queue ! mux. mux. ! queue ! shout2send port=8000 password=PASS mount=YOURMOUNTPOINT.ogg

Streaming Communities and ResourcesEdit


GISS is a volunteer, non-commercial network created with free software for free media.