Difference between revisions of "2008.RMLL.info recording"

From ElphelWiki
Jump to: navigation, search
(Pure-Data patch)
(Streaming)
 
(5 intermediate revisions by the same user not shown)
Line 41: Line 41:
  
 
==FreeSoftware==
 
==FreeSoftware==
 +
 +
List of freesoftware needed to record video/audio, mux and stream.
 +
 +
 +
Of course standard GNU/Linux
 +
 +
mencoder to record video
 +
 +
gstreamer-0.10 to record audio
 +
 +
ogmmerge from ogmtools to mux ogg vorbis sound produce by gstreamer and mjpeg video from mencoder
 +
 +
ffmpeg2theora to encode on theora ( minimum version is 0.19 )
 +
 +
oggfwd to send video and icecast server
 +
 +
icecast2 for streaming the ogg/theora file
 +
 +
 +
 +
On standard ubuntu 7.10 i've got all this software with apt-get.
  
 
==Ubuntu Desktop==
 
==Ubuntu Desktop==
Line 57: Line 78:
  
 
===Recording audio===
 
===Recording audio===
 +
 +
To record audio there is new elphel cam with USB where you can plug USB microphone ( recommended SAMSON USB MIC ) BUT
 +
she is not avaivable for this events :( so we need to find solution to record audio.
 +
 +
The solution is a computer ... :(
 +
 +
 +
For this we need standard computer with soundcard alsa compatible and gstreamer-0.10 software.
 +
To record audio i use this scripts made by luxigo.
 +
 +
<pre>
 +
#!/bin/sh
 +
 +
# audio settings
 +
AUDIO_DEVICE="hw:0,0"
 +
AUDIO_BITRATE=48000
 +
 +
# output file name
 +
OUTFILE="out.ogg"
 +
 +
DEBUG="-v -m"
 +
 +
gst-launch-0.10 $DEBUG \
 +
\
 +
oggmux name=mux \
 +
! filesink location="$OUTFILE" \
 +
\
 +
fdsrc fd=0 \
 +
! queue \
 +
! oggparse \
 +
! oggdemux \
 +
! ogmvideoparse \
 +
! mux. \
 +
\
 +
alsasrc \
 +
device="$AUDIO_DEVICE" \
 +
! queue \
 +
! audioconvert \
 +
! vorbisenc bitrate=$AUDIO_BITRATE \
 +
! mux.
 +
 +
# Description of the gst-launch command above:
 +
 +
# - the muxed stream (the output from the oggmux element) will be
 +
#  stored in a file (filesink)
 +
 +
# - The video comes from ElphelOgm through stdin (fdsrc fd=0).
 +
# - The ogg stream is parsed for security (optional?) and demuxed.
 +
# - The ogmvideo stream is also parsed for security (optional?).
 +
# - The resulting mjpeg stream is sent to the ogg muxer through the
 +
#    "mux." element (defined with "oggmux name=mux").
 +
#  (This syntax could also be used for oggdemux but here there's only
 +
#  a single stream in the incoming ogg container so we dont need to
 +
#  complicate things here)
 +
 +
# - The sound comes from an alsa device through alsasrc,
 +
# - The sound is converted in a suitable format then encoded in vorbis,
 +
#  before being muxed with the video stream
 +
</pre>
  
 
===Recording video===
 
===Recording video===
 +
 +
We've got different way to record video from elphel camera. The newest way to record is camogm/cam2ogm but we need nfs server or hard drive directly connected to the camera but we don't have camera with harddrive and nfs server is not what i prefer..  We can also use ElphelOgm but we are some artefact with this so i choose to use classic mencoder way to record video like this :
 +
 +
<pre>
 +
mencoder rtsp://ipcamera:554 -ovc copy -fps 24.99 -frames 250000 -o outputv.avi
 +
 +
</pre>
 +
 +
the option frames 250000 produce approximatively 2 hours of video on 1920x1088 format.
  
 
===Muxing audio with video===
 
===Muxing audio with video===
 +
 +
To mux of audio and video we use ogmmerge from ogmtools like this :
 +
 +
 +
<pre>
 +
ogmmerge -o sync.ogg out.ogg outputv.avi
 +
</pre>
 +
 +
There is an option -sync if you need an audio track synchronized.
 +
 +
<pre>
 +
$ ogmmerge -o goodsync.ogm -A source.avi -s 200 outofsync.ogg
 +
 +
      This would add 200ms of silence at the beginning of  the  audio  tracks
 +
      taken  from outofsync.ogg. And -s always applies to all audio tracks in
 +
      a source file. If you want to apply -s only to a  specific  track  then
 +
      take the same source file more than once and add -a and -s accordingly.
 +
 +
</pre>
 +
from man ogmmerge
  
 
===Transcoding to Theora/Vorbis===
 
===Transcoding to Theora/Vorbis===
 +
 +
 +
For the the transcoding we use ffmpeg2theora ( minimum version 0.19 ) to encode the mjpeg and oggvorbis on the ogg/theora file.
 +
 +
<pre>
 +
cat sync.ogg | ffmpeg2theora -p preview -o final.ogg -
 +
</pre>
  
 
===Streaming===
 
===Streaming===
 +
 +
 +
Finally to stream for the world we use icecast2 server.
 +
 +
Send the ogg/theora files with oggfwd like this.
 +
 +
 +
<pre>
 +
cat final.ogg | oggfwd ip_of_icecast_server port password /stream.ogg
 +
</pre>
 +
 +
Of course you need to configure icecast2 server before.

Latest revision as of 16:54, 24 June 2008

Prefix

We had some contacts with organizers of http://2008.rmll.info/?lang=en and decided to participate recording all conferences with Elphel NC353L network cameras.

Goals

The goal is:

  • record all the conferences in high resolution. (from 640x480 to 1920x1080p)
  • restream few conferences in real time
  • upload ALL conferences on RMLL site and google video and as many support as possible.
  • keep high quality 1920x1080p MJPEG sources for all conferences what will be post processed.
  • have at least 1 camera per conference room and 2-4 camera for a very important conferences what will be post processed.
  • do all that with exclusively FreeSoftware

Hardware

This section will describe used hardware.

Cameras

We will bring 14 cameras with lenses and POE injectors.

POE injectors

We will bring POE injectors with us.

Lenses

We will use Computar H2Z0414C-MP Varifocal Lens, 4-8mm F1.4 Manual Iris Vari-Focal C-Mount, 3MPix. We will have 10-12 of such lense + 2 5MPix fisheyes. Maybe we will have some other good quality lenses.

PC

Requirement

If we do not want to stream or transcode in live a X40 IBM thinkpad or equivalent is OK.

If we do want to mux, transcode and stream in realtime a core2duo or quadro 2.4 Ghz and with 2GB RAM minimum is more welcome.

Microphones

Tripods

Network

Software

FreeSoftware

List of freesoftware needed to record video/audio, mux and stream.


Of course standard GNU/Linux

mencoder to record video

gstreamer-0.10 to record audio

ogmmerge from ogmtools to mux ogg vorbis sound produce by gstreamer and mjpeg video from mencoder

ffmpeg2theora to encode on theora ( minimum version is 0.19 )

oggfwd to send video and icecast server

icecast2 for streaming the ogg/theora file


On standard ubuntu 7.10 i've got all this software with apt-get.

Ubuntu Desktop

Special scripts for recording

Pure-Data patch

Here there is a simple patch for pure data to record, mux sound and stream on icecast server. You can download this patch here :

http://community.elphel.com/files/elencode.pd

Change the path of your need and launch this with pd name_you_choose.pd

Recording audio

To record audio there is new elphel cam with USB where you can plug USB microphone ( recommended SAMSON USB MIC ) BUT she is not avaivable for this events :( so we need to find solution to record audio.

The solution is a computer ... :(


For this we need standard computer with soundcard alsa compatible and gstreamer-0.10 software. To record audio i use this scripts made by luxigo.

#!/bin/sh

 # audio settings
 AUDIO_DEVICE="hw:0,0"
 AUDIO_BITRATE=48000

 # output file name
 OUTFILE="out.ogg"

 DEBUG="-v -m"

 gst-launch-0.10 $DEBUG \
 \
	oggmux name=mux \
	! filesink location="$OUTFILE" \
 \
	fdsrc fd=0 \
	! queue \
	! oggparse \
	! oggdemux \
	! ogmvideoparse \
	! mux. \
 \
	alsasrc \
		device="$AUDIO_DEVICE" \
	! queue \
	! audioconvert \
	! vorbisenc bitrate=$AUDIO_BITRATE \
	! mux.

 # Description of the gst-launch command above:

 # - the muxed stream (the output from the oggmux element) will be
 #   stored in a file (filesink)

 # - The video comes from ElphelOgm through stdin (fdsrc fd=0).
 # - The ogg stream is parsed for security (optional?) and demuxed.
 # - The ogmvideo stream is also parsed for security (optional?).
 # - The resulting mjpeg stream is sent to the ogg muxer through the
 #    "mux." element (defined with "oggmux name=mux"). 
 #   (This syntax could also be used for oggdemux but here there's only
 #   a single stream in the incoming ogg container so we dont need to
 #   complicate things here) 

 # - The sound comes from an alsa device through alsasrc,
 # - The sound is converted in a suitable format then encoded in vorbis,
 #   before being muxed with the video stream

Recording video

We've got different way to record video from elphel camera. The newest way to record is camogm/cam2ogm but we need nfs server or hard drive directly connected to the camera but we don't have camera with harddrive and nfs server is not what i prefer.. We can also use ElphelOgm but we are some artefact with this so i choose to use classic mencoder way to record video like this :

mencoder rtsp://ipcamera:554 -ovc copy -fps 24.99 -frames 250000 -o outputv.avi 

the option frames 250000 produce approximatively 2 hours of video on 1920x1088 format.

Muxing audio with video

To mux of audio and video we use ogmmerge from ogmtools like this :


ogmmerge -o sync.ogg out.ogg outputv.avi

There is an option -sync if you need an audio track synchronized.

 $ ogmmerge -o goodsync.ogm -A source.avi -s 200 outofsync.ogg

       This would add 200ms of silence at the beginning of  the  audio  tracks
       taken  from outofsync.ogg. And -s always applies to all audio tracks in
       a source file. If you want to apply -s only to a  specific  track  then
       take the same source file more than once and add -a and -s accordingly.

from man ogmmerge

Transcoding to Theora/Vorbis

For the the transcoding we use ffmpeg2theora ( minimum version 0.19 ) to encode the mjpeg and oggvorbis on the ogg/theora file.

cat sync.ogg | ffmpeg2theora -p preview -o final.ogg - 

Streaming

Finally to stream for the world we use icecast2 server.

Send the ogg/theora files with oggfwd like this.


cat final.ogg | oggfwd ip_of_icecast_server port password /stream.ogg 

Of course you need to configure icecast2 server before.