Changes between Version 22 and Version 23 of free-video-streaming-technology


Ignore:
Timestamp:
Aug 7, 2014, 4:48:17 PM (6 years ago)
Author:
https://id.mayfirst.org/kosa
Comment:

I added usb camera and desktop to dvswitch support, as well as high and low quality recording instructions.

Legend:

Unmodified
Added
Removed
Modified
  • free-video-streaming-technology

    v22 v23  
    2727
    2828{{{
    29 aptitude install dvswitch oggfwd ffmpeg ffmpeg2theora dvsource dvsink
     29aptitude install dvswitch oggfwd ffmpeg ffmpeg2theora dvsource dvsink libav-tools pulseaudio-utils
    3030}}}
    3131
     
    3333
    3434{{{
    35 sudo apt-get install dvswitch oggfwd ffmpeg ffmpeg2theora dvsource dvsink
     35sudo apt-get install dvswitch oggfwd ffmpeg ffmpeg2theora dvsource dvsink libav-tools pulseaudio-utils
    3636}}}
    3737
     
    3939Depending on the hardware, bandwidth, LAN, and other physical constraints, there can be some flexibility in how much hardware this requires. There are some general things that will make your life easier.
    4040
    41  * A DV camera with firewire (or USB). Firewire transfers data at a higher rate, however many newer cameras do not have Firewire. In this case you may be better off with a slightly older camera. DV cams are preferable to other USB cams, like cheap webcams; these [please clarify which if these "these" refers to, DV cams or USB cams] can be made to work, but are not well supported.
     41 * One ore more DV cameras with firewire. Firewire transfers data at a higher rate, however many newer cameras do not have Firewire. In this case you may be better off with a slightly older camera. Take note that most FW cameras have optical and digital zoom and some other functions, while most usb cameras dont'
     42 * One or more usb cameras.
    4243 * A computer with appropriate ports for the camera, and a working NIC (runs dvsource).
    4344 * A computer with good graphics support, reasonable processor, at least 2G of RAM and a working NIC (runs dvswitch).
     
    8081 * Make sure it is connected to the LAN
    8182 * Launch "dvswitch" either from a terminal or a window manager launcher.
    82 {{{
    83 dvswitch -h localhost -p 2000
     83
     84You would need two parameters: the port and the host. As for port you can use whatever you want but 2000 is recomended and >1024 is mandatory.
     85If you want to use cameras connected to other computers you would need to use the ip of the computer running dvswitch, which you can get running this command and look for a number different to 127.0.0.1 and likely to start with 192.
     86
     87{{{
     88/sbin/ifconfig|grep inet
     89}}}
     90
     91outpt exmple:
     92
     93{{{
     94~$ /sbin/ifconfig |grep inet
     95          inet addr:127.0.0.1  Mask:255.0.0.0
     96          inet6 addr: ::1/128 Scope:Host
     97          inet addr:192.168.1.73  Bcast:192.168.1.255  Mask:255.255.255.0
     98          inet6 addr: fe80::aabb:cfff:fe18:349e/64 Scope:Link
     99}}}
     100
     101If you are not planning to send video streams from other computers, you can use 'localhost' insted of the ip address.
     102
     103From now on you should use 'localhost' or the ip number, depending of what you have choosen, instead  of DVSWITCHHOST.
     104
     105So run this command to start dvswitch:
     106
     107{{{
     108dvswitch -h DVSWITCHHOST -p 2000
    84109}}}
    85110 * '''NOTE:''' You have to start DVswitch before starting the source or the sink.
    86111
    87 === On the machine connected to the camera ===
     112== On the machine connected to the camera ==
     113=== if using a firewire cam ===
    88114 * Connect a DV cam via Firewire to the  machine
    89115 * Double check your  LAN connection.
     
    96122 Where DVSWITCHHOST is either the domain, IPV4 or IPV6 address of the machine running DVswitch. The "-p" flag specifies the port on which the DVswitch is listening.
    97123 
    98 === On the DVsink machine ===
     124
     125=== if using an USB cam ===
     126
     127 * Connect the usb cam to the computer if you want to use a wires cam insted of the built in most laptops come with.
     128 * look for the video input divece you are going to use with this command
     129{{{
     130ls /dev/video*
     131}}}
     132
     133it should return someting like:
     134
     135{{{
     136/dev/videoX
     137}}}
     138
     139being X a number depending of the number of cameras connected to the computer. This would show up if you have 2 usb cameras connected to the computer:
     140
     141{{{
     142ls /dev/video*
     143/dev/video0
     144/dev/video1
     145}}}
     146
     147Run the next command to grab the video comming from the usb cam and pipe it to the dvsource-file command to send it to dvswitch.
     148
     149{{{
     150avconv  -f video4linux2  -i /dev/videoX  -target ntsc-dv - | dvsource-file /dev/stdin -p 2000 -h DVSWITCHHOST
     151}}}
     152
     153Notice using the number of the cam insted of the X in the command line above.
     154Also note that we are sending an ntsc-dv video format but it could be pal-dv. This matters if you are using more than 1 camera, as the first video stream sent to dvswitch will set the 'default' format and the other sources would need to stick with it.
     155
     156Finally, note you can run this command on different computers at the same time to feed dvswitch with several video streams if you use the ip of the computer running dvswitch insted of using 'localhost'
     157
     158=== if you want to stream you desktop ===
     159
     160First of you would need to get the size of your screen. You can use this command to get it and store it in a variable called 'PANTALLA'
     161
     162{{{
     163export PANTALLA=$(xdpyinfo | awk '/dimensions:/ { print $2; exit }')
     164}}}
     165
     166and verify the size echoing that variable with the following command:
     167
     168{{{echo $PANTALLA}}}
     169
     170Now you can stream you desktop to dvswitch running this:
     171
     172{{{
     173avconv -f x11grab -s $PANTALLA -r 29 -i :0.0 -target ntsc-dv -y - | dvsource-file /dev/stdin -p 2000 -h DVSWITCHHOST
     174}}}
     175
     176Note that you would create and infinite (funny) loop if you run this command on the same computer running dvswitch but it won't harm. =)
     177
     178
     179== On the DVsink machine ==
    99180 * Make sure that you have the "ffmpeg2theora" and "oggfwd" packages installed.
    100181 * Run:
     
    123204}}}
    124205
    125 === Testing the Stream ===
     206== Testing the Stream ==
    126207You're now ready to test the stream. In a browser that supports ogg/theora, or a standalone player (like VLC), and open: {{{ http://ICECASTHOST/mountpoint.ogg }}}. If you see a video you have a working single camera stream.
    127208
    128209More source machines can be added. DVswitch allows you to switch sources, as well as use varied audio sources (alsa), and DV files.
    129210
     211== Recording your stream ==
     212
     213You can record your stream on two different ways and qualities.
     214
     215=== Higher stream quality ===
     216
     217The first way would get the highest quality avaliable from the video sources, and would save it as a .dv file. This might be awesome but it also might  consume a huge ammount of disk space. If you have enough room to store yout recording, you can run this command to start recording directly from dvsiwtch:
     218
     219{{{
     220dvsink-files -h DVSWITCHHOST -p 2000 FILENAME-OF-THE-RECORDING
     221}}}
     222
     223Now press the 'record' button at the dvswitch interface to start/stop recording, and the 'cut' one to create a new file with the same name but a highet number
     224
     225=== Lower stream quality ===
     226
     227You can also record the stream locally at the same quality you are streaming through the ffmpg2theora command we used above to send the stream to the Icecast2 server. In this case you would only need to add {{{-o recording-file-name.ogv -}}} to the same command you used before. Like this:
     228
     229 
     230{{{
     231dvsink-command -h DVSWITCHHOST -p 2000 tee out.dv | ffmpeg2theora - -f dv -F 25:5 --speedlevel 0 -v 4 -a 1 -c 1 -H 9600 -o recording-file-name.ogv  -o - | oggfwd ICECASTHOST ICECASTPORT ICECASTPASS /mountpoint.ogg
     232}}}
     233
     234Please note that you would overwrite the first recording if you run that command twice, ase you ae using the same filename. You could is a $date variable to prevent this from happening. Like this:
     235
     236{{{
     237dvsink-command -h DVSWITCHHOST -p 2000 tee out.dv | ffmpeg2theora - -f dv -F 25:5 --speedlevel 0 -v 4 -a 1 -c 1 -H 9600 -o recording-file-name-$(date +"%T_%d-%m-%Y").ogv  -o - | oggfwd ICECASTHOST ICECASTPORT ICECASTPASS /mountpoint.ogg
     238}}}
     239