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. |
| 21 | output=alsa_output.usb-SADES_Electronics_Inc._SADES_Snuk-00.analog-stereo.monitor |
| 22 | |
| 23 | # Set the icecast server URL, including password. |
| 24 | server="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 }'` |
| 29 | dimensions=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. |
| 34 | video_bits=.15M |
| 35 | |
| 36 | name="May First/People Link" |
| 37 | description="MF/PL annual Membership Meeting" |
23 | | export SONIDO=$(pactl list sources |awk '/Name:/ {print $2;exit}') |
| 43 | #!/bin/bash |
| 44 | |
| 45 | config_file=~/.config/stream-desktop |
| 46 | if [ ! -f "$config_file" ]; then |
| 47 | printf "Please create the file %s and set all configuration parameters.\n" "$config_file" |
| 48 | exit 1 |
| 49 | fi |
| 50 | source "$config_file" |
| 51 | |
| 52 | ffmpeg -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" |
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 |