Jump to content

Puredyne/Stream Audio and Video

From Wikibooks, open books for an open world

Software

[edit | edit source]

Darkice

[edit | edit source]

FIXME

Liquid Soap

[edit | edit source]

FIXME

ffmpeg2theora

[edit | edit source]

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 icecast.example.org 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.

ices2

[edit | edit source]

FIXME

FreeJ

[edit | edit source]

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:

<syntaxhighlight lang="text"> // 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

encoder.add_audio(audio);


// Configure the encoder to stream over an Icecast server

encoder.stream_host("giss.tv");

encoder.stream_port(8000);

encoder.stream_title("testing new freej");

encoder.stream_username("source");

encoder.stream_password("2t645");

encoder.stream_mountpoint("freej-test.ogg");

// Register the encoder on the running FreeJ engine

register_encoder(encoder);

// Start a network stream

encoder.start_stream();

// Record the stream into a local file

encoder.start_filesave('Video/freej-test.ogg');

</syntaxhighlight lang="text">

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...

Gstreamer

[edit | edit source]

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.

alternative:

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 ip=giss.tv port=8000 password=PASS mount=YOURMOUNTPOINT.ogg

Streaming Communities and Resources

[edit | edit source]

GISS.tv

[edit | edit source]

GISS is a volunteer, non-commercial network created with free software for free media. http://giss.tv