Changes between Version 9 and Version 10 of StreamDesktop


Ignore:
Timestamp:
Sep 12, 2018, 10:03:03 AM (15 months ago)
Author:
Jamie McClelland
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • StreamDesktop

    v9 v10  
    11= Streaming what is on your desktop =
    22
    3 See also [wiki:free-video-streaming-technology how to stream live video from your camera].
     3See also [wiki:broadcast how to stream live video from your camera].
    44
    5 You might need to stream everything happening in you desktop (as if you want others to be able to watch a videoconference going on live.mayfirst.org without them being on the room) and here's an easy way to do it with a single command line (3 commands being piped all together).
     5You might need to stream everything happening in you desktop.
    66
    7 You would need to use a Debian based distro and install these packages (avconv in inside libav-tools and some packages are specific to wheezy, i.e. ffmpeg is not in jessie or sid):
     7You would need to use a Debian based distro and install these packages:
    88
    99{{{
    10 aptitude install  oggfwd ffmpeg2theora ffmpeg libav-tools pulseaudio-utils
    11 
     10sudo apt install ffmpeg pulseaudio-utils
    1211}}}
    1312
    14 Then you need to find out what's the output name of you soundcard (as you want to stream what's coming out from your soundcard, not what's going in through your mic) and you can do it this way:
     13Next, create a configuration file called .config/stream-desktop and add the following to it (change as needed):
    1514
    1615{{{
    17 pactl list sources |grep alsa_output
     16# This file is sourced by the stream-desktop script
     17
     18# Set output device. Use the command: `pactl list sources | grep alsa_output` to find the
     19# right one. If you have a USB headset or some other device, it might not be the alsa device
     20# that is the active one.
     21output=alsa_output.usb-SADES_Electronics_Inc._SADES_Snuk-00.analog-stereo.monitor
     22
     23# Set the icecast server URL, including password.
     24server="icecast://source:CHANGEME@a.stream.mayfirst.org:8000/meeting.webm"
     25
     26# Set your screen dimensions. For performance reasons I am keeping it very low.
     27# If you want to set it to your maximum resolution for your monitor, you can
     28# find your dimensions with: `xdpyinfo | awk '/dimensions:/ { print $2; exit }'`
     29dimensions=640x480
     30
     31# video bits is the main quality marker. .15M seems the lowest you can go without
     32# sacrificing too much quality. 1.5M gives really good video quality, but doesn't
     33# play too well.
     34video_bits=.15M
     35
     36name="May First/People Link"
     37description="MF/PL annual Membership Meeting"
    1838}}}
    1939
    20 You might directly store the output in a variable so you can use it later. Like this:
     40Lastly, create a file called stream-desktop in your ~/bin directory and add the following:
    2141
    2242{{{
    23 export SONIDO=$(pactl list sources |awk '/Name:/ {print $2;exit}')
     43#!/bin/bash
     44
     45config_file=~/.config/stream-desktop
     46if [ ! -f "$config_file" ]; then
     47  printf "Please create the file %s and set all configuration parameters.\n" "$config_file"
     48  exit 1
     49fi
     50source "$config_file"
     51
     52ffmpeg -loglevel info \
     53  -f x11grab -show_region 1 -thread_queue_size 32 -video_size "$dimensions" -framerate 30 -i :0.0  \
     54  -f pulse  -i "$output" \
     55  -f webm -af aresample=async=1 -cluster_size_limit 2M -cluster_time_limit 5100 -content_type video/webm \
     56  -c:a libvorbis -b:a 96K \
     57  -c:v libvpx -b:v "$video_bits" -crf 30 -g 30 -deadline good -threads 3 \
     58  "$server"
    2459}}}
    25 
    26 You also need to get the size of you screen with this one:
    27 
    28 {{{
    29 xdpyinfo | awk '/dimensions:/ { print $2; exit }'
    30 }}}
    31 
    32 and you might want to store that in a variable too. Like this:
    33 
    34 {{{
    35 export PANTALLA=$(xdpyinfo | awk '/dimensions:/ { print $2; exit }')
    36 }}}
    37 
    38 Finally, you can run this command using the variables you have created already:
    39 
    40 {{{
    41 avconv  -f pulse -i $SONIDO -f x11grab -s $PANTALLA -r 29 -i :0.0 -target pal-dv -y - |\
    42 ffmpeg2theora - -f dv -F 25:5 --speedlevel 0 --width 360 --height 240 -v 5 -a 5 -c 1 -H 9600 -o - |\
    43 oggfwd   -n 'NOMBRE' -g 'GENERO' -d 'DESCRIPCION' a.stream.mayfirst.org 8000 source /stream-de-prueba.ogv
    44 }}}
    45 
    46 Please notice you can set the name, genre, and description by replacing the words in CAPITALS. You can also replace the '/stream-de-prueba.ogv' for the right name for your stream, and watch it here:
    47 
    48 http://a.stream.mayfirst.org:8000/stream-de-prueba.ogv
    49 
    50 You can also specify video and audio quality by changing -v and -a (the higher the value the better the quality) respectively.
    51 
    52 
    53 
    54 And here we have a variation of the same scenario, if you wish to stream an audio only session.
    55 
    56 {{{
    57 export SONIDO=$(pactl list sources|awk '/Name:/ {print $2;exit}')
    58 avconv  -f pulse -i $SONIDO -f ogg - |\
    59 ffmpeg2theora - --no-skeleton --novideo -o - |\
    60 oggfwd   -n 'NOMBRE' -g 'GENERO' -d 'DESCRIPCION' a.stream.mayfirst.org 8000 source /stream-de-prueba.ogg
    61 }}}
    62 
    63 
    64 For more about the parameters you can use please refer to the man pages of every command
    65 
    66 avconv http://manpages.ubuntu.com/manpages/precise/man1/avconv.1.html
    67 ffmpeg2theora http://man.cx/ffmpeg2theora(1)
    68 oggfwd http://man.devl.cz/man/1/oggfwd