Stream from Blackmagic Decklink Recorder using VLC

This tutorial will assume you have VLC already installed with Decklink support. If you don’t you’ll have to download Decklink SDK and VLC source code, plus some other tools if you want to stream directly from VLC. Check the tutorial here.

mpgv & mpga

cvlc -vvv -I dummy decklink:// --decklink-video-connection=hdmi --decklink-mode=Hi50 --decklink-aspect-ratio=16:9 --rt-priority --swscale-mode=0 --live-caching=750 --sout-mux-caching=750 --sout '#transcode{vcodec=mpgv,vb=2000,fps=25,vfilter={deinterlace},scale=1,acodec=mpga,ab=98,threads=4}:std{access=udp,mux=ts,dst=10.0.0.4:5010}' --no-sout-transcode-hurry-up --sout-all

This was by far the best results I’ve achieved. MPEG video is very light (cpu wise) and probably the most reliable.

h264 & mpga

cvlc -vvv --live-caching 2000 --sout-x264-profile main --decklink-video-connection hdmi --decklink-card-index 0 decklink:// --decklink-audio-connection embedded --decklink-aspect-ratio 16:9 --decklink-mode hp50 --sout-x264-preset superfast --sout-x264-tune film --sout-transcode-threads 4 --no-sout-x264-interlaced --sout-x264-keyint 50 --sout-x264-lookahead 100 --sout-x264-vbv-maxrate 4000 --sout-x264-vbv-bufsize 6000 --sout '#transcode{vcodec=h264,vb=5000,acodec=aac,ab=256}:std{access=udp,mux=ts,dst=10.0.0.4:5010}'

Note that, x264 encoding takes its toll on your CPU. Using an Intel i3 core CPU the maximum it could take was superfast. Ultrafast is even better but its quality is a bit worse. I think using 64 bits CPU is a bit better.

The output results are quite acceptable although i’m still having some issues with the transport stream muxing, i.e. libdvbpsi. All I see is a bunch of pictures that might be displayed late (missing x ms).

Any notes that might help reduce this input problem in the client are always welcome.

Compile x264 and VLC with Decklink SDK

Quick notes on how to compile all of these tools to make VLC work decklink tools.

x264

First go to x264 and download it.

user@testbed:/home/user# cd ~/
user@testbed:/home/user# wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
user@testbed:/home/user# tar -jxvf last_x264.tar.bz2
user@testbed:/home/user# cd x264*
user@testbed:/home/user/x264*# ./configure --enable-shared --disable-asm
user@testbed:/home/user/x264*# make -j $(grep -c processor /proc/cpuinfo)
user@testbed:/home/user/x264*# sudo make install

FAAC

user@testbed:/home/user# cd ~/
user@testbed:/home/user# wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
user@testbed:/home/user# tar -jxvf faac-1.28.tar.gz
user@testbed:/home/user# cd faac*
user@testbed:/home/user/faac*# ./configure
user@testbed:/home/user/faac*# make -j $(grep -c processor /proc/cpuinfo)
user@testbed:/home/user/faac*# make install

FFMpeg

user@testbed:/home/user# cd ~/
user@testbed:/home/user# wget http://www.ffmpeg.org/releases/ffmpeg-2.1.4.tar.gz
user@testbed:/home/user# tar -zxvf ffmpeg-2.1.4.tar.gz
user@testbed:/home/user# cd ffmpeg*
user@testbed:/home/user/ffmpeg*# ./configure --disable-yasm --disable-ffserver --disable-ffprobe --disable-ffplay --enable-libfaac --enable-nonfree --enable-libx264 --enable-gpl
user@testbed:/home/user/ffmpeg# make -j $(grep -c processor /proc/cpuinfo)
user@testbed:/home/user/ffmpeg# make install

Decklink SDK

Download Decklink SDK and extract it.

VLC

On this step you need to make sure that you point the SDK path to the right place. You can check it using the pwd command inside the SDK folder.


user@testbed:/home/user# cd ~/
user@testbed:/home/user# wget http://download.videolan.org/pub/videolan/vlc/2.1.4/vlc-2.1.4.tar.xz
user@testbed:/home/user# tar -xvf vlc-2.1.4.tar.xz
user@testbed:/home/user# cd vlc*
user@testbed:/home/user/vlc*# ./configure --disable-qt4 --disable-skins2 --disable-xcb --enable-twolame --enable-dvbpsi --disable-dbus --enable-lua --disable-mad --disable-postproc --disable-a52 --disable-libgcrypt --disable-dbus --enable-run-as-root --enable-x264 --disable-nls --enable-httpd --disable-dvdnav --disable-dshow --disable-bluray --disable-smb --disable-live555 --disable-vcd --disable-libcddb --disable-ogg --disable-mux_ogg --disable-shout --disable-mkv --disable-dvdread --disable-samplerate --disable-udev --disable-upnp --disable-mtp --disable-flac --disable-notify --disable-bonjour --disable-caca --disable-libass --disable-schroedinger --disable-theora --disable-opus --disable-speex --disable-vorbis --disable-dirac --disable-telx --disable-fluidsynth --disable-dca --disable-libmpeg2 --disable-goom --disable-dv --disable-svg --disable-kate --disable-sftp --disable-sid --disable-dc1394 --disable-opencv --disable-gnomevfs --disable-sdl --disable-taglib --disable-libxml2 --disable-portaudio --disable-telx --disable-libva --disable-jack --disable-mod --disable-projectm --disable-faad --with-decklink-sdk=/home/user/DecklinkSDK/Linux
user@testbed:/home/user/vlc*# make -j $(grep -c processor /proc/cpuinfo)
user@testbed:/home/user/vlc*# make install

How to sync different HLS bitrates with FFMpeg

HLS is an awesome streaming protocol. Forget Dash, forget HDS, HLS is probably the most supported among many vendors. Android 4.X fully supports this protocol, even though there are some minor issues when changing from different bitrates.

The following scripts were tested using an iPhone 4 with iOS 7, and an Android 4.1. They both work fine, but iPhone is way better in terms of its adaptive algorithm.

The input stream was H264 Main with 720×576 resolution. Audio was aac_latm. I tried to remux into different chunks without reencoding but it did not work. I had to encode both Audio and Video to properly play in iOS.

I used an Ubuntu 11.10 64 bit version, with FFMpeg 2.1.3, along with a 4 core Intel Xeon E3-1220. Four bitrates (256, 512, 1024, 1436) with veryfast preset occupies roughly 2 cores. For better margins you can use superfast or ultrafast preset.

processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Xeon(R) CPU E31220 @ 3.10GHz
stepping : 7
cpu MHz : 3092.956
cache size : 8192 KB

INPUT:

Input #0, mpegts, from ‘udp://239.192.1.1:1234’:
Duration: N/A, start: 52236.297844, bitrate: N/A
Program 1101
Stream #0:0[0x20](por): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Stream #0:1[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg), 720×576 [SAR 16:11 DAR 20:11], 25 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0:2[0x101](por): Audio: aac_latm ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
Stream #0:3[0x102](por): Audio: aac_latm ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp (visual impaired)

How to create the HLS streams

This is the source code for the hls daemon. This script launches the FFmpeg daemon with all the parameters required. This hls script is launched by an upstart job.

root@transcoder:/usr/src# cat hls.sh
#!/bin/bash

NAME=$1
CHANNEL=$2
BR=$3
MAXRATE=`expr $3 + 100`
BUFSIZE=`expr $3 + 500`
# Change this to superfast or veryfast for lower computational needs
PRESET="veryfast"

BRPLAYLIST="${BR}_${NAME}"

options="  -vbsf h264_mp4toannexb -flags -global_header -c:v libx264 -b:v ${BR}k -maxrate ${MAXRATE}k -bufsize ${BUFSIZE}k -threads 4 -preset ${PRESET} -profile:v main  -flags +cgop -c:a libfaac -b:a 64k -ac 2  "

segmentoptions=" -f segment -segment_list ${BRPLAYLIST}.m3u8 -segment_list_flags -cache+live -segment_time 10 -segment_list_size 5 -segment_format mpegts -copyts "

ffmpeg -y -i udp://${CHANNEL}:1234 -probesize 500000 -map 0:1 -map 0:2 $options $segmentoptions "${BRPLAYLIST}_%05d.ts"

I then placed four upstart files to match the bandwidths I was looking for.

root@transcoder:/home/nonius# ls /etc/init/*rtp*
/etc/init/rtp1024.conf /etc/init/rtp256.conf /etc/init/rtp1436.conf /etc/init/rtp512.conf

Example of one of these upstart jobs.

start on filesystem or runlevel [2345]
stop on runlevel [!2345]

respawn
respawn limit 10 5
umask 022

chdir /var/run/www
exec /usr/src/hls.sh rtp 239.192.1.1 512

OUTPUTS:

Each of the outputs is close to the selected output but still a couple of kbs above. This is due to the maxrate being calculated with input+100, I think. This translates into higher bitrates at certain times. One can perhaps mitigate this by placing the maxrate equal to the bitrate required. But all in all in a long term run, the bitrates come down to the selected ones.

Input #0, mpegts, from ‘1436_rtp_00124.ts’:
Duration: 00:00:10.03, start: 51597.172356, bitrate: 1784 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 720×576 [SAR 16:11 DAR 20:11], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 56 kb/s

Input #0, mpegts, from ‘1024_rtp_00124.ts’:
Duration: 00:00:10.03, start: 51597.172356, bitrate: 1329 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 720×576 [SAR 16:11 DAR 20:11], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 57 kb/s

Input #0, mpegts, from ‘512_rtp_00124.ts’:
Duration: 00:00:10.03, start: 51597.172356, bitrate: 750 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 720×576 [SAR 16:11 DAR 20:11], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 56 kb/s

Input #0, mpegts, from ‘256_rtp_00124.ts’:
Duration: 00:00:10.03, start: 51597.172356, bitrate: 464 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 720×576 [SAR 16:11 DAR 20:11], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 57 kb/s

So how do we create several of these and have them in sync with each other? My trick was to simply use the -copyts. This translates into an almost perfect sync between different bitrates. Obviously all the daemons have to start mostly at the same time, with some ms between them. But for those of you who are more skeptic I’ve attached some of the results of the hole process.

256_rtp_00124.ts
512_rtp_00124.ts
1024_rtp_00124.ts
1436_rtp_00124.ts

The only thing missing is the main adaptive playlist:

root@transcoder:/run/www# cat rtp.m3u8

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=256000,RESOLUTION=720x576
256_rtp.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=512000,RESOLUTION=720x576
512_rtp.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1024000,RESOLUTION=720x576
1024_rtp.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1536000,RESOLUTION=720x576
1436_rtp.m3u8

Note:

VLC 2.1.3 seems to have some issues with Live event HLS playback. This is due to the fact that it downloads several chunks in a row, plays them and misses the next window in time. I’m not sure why this happens, but iPhone and Android have worked flawless for me expect for some Android glitches.

Install SoftEther VPN Server in CentOS

SoftEther is a VPN server just like OpenVPN. But a better VPN server because it has a lot more options and its actually faster than OpenVPN, besides working a lot better.

So first install wget if you don’t have it and download the appropriate package. Its easier to download the Server directly instead of the source code.

Installing VPN Server

[root@Vpnserver src]# yum install -y wget gcc vim
[root@Vpnserver src]# wget download_link.tar.gz
[root@Vpnserver src]# tar -zxvf download_link.tar.gz
[root@Vpnserver src]# cd vpnserver
[root@Vpnserver src]# make (..Agree to everything obviously)
[root@Vpnserver src]# mkdir /usr/local/vpnserver
[root@Vpnserver src]# cp vpnserver vpncmd hamcore.se2

Now that everything is in place all you need is something that will start/stop the vpnserver service. So we need create a new file called vpnserver and paste the source below.

Setting VPN service

[root@Vpnserver src]# vim /etc/init.d/vpnserver

#!/bin/sh
# chkconfig: 2345 99 01
# description: SoftEther VPN Server
DAEMON=/usr/local/vpnserver/vpnserver
LOCK=/var/lock/subsys/vpnserver
test -x $DAEMON || exit 0
case "$1" in
start)
$DAEMON start
touch $LOCK
;;
stop)
$DAEMON stop
rm $LOCK
;;
restart)
$DAEMON stop
sleep 3
$DAEMON start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0

[root@Vpnserver vpnserver]# chmod 755 /etc/init.d/vpnserver
[root@Vpnserver vpnserver]# service vpnserver start
SoftEther VPN Server Service Started.
[root@Vpnserver vpnserver]# /sbin/chkconfig –add vpnserver

You can now make a quick check just to make sure the server is running properly. Run vpncmd and select option 3.

[root@Vpnserver vpnserver]# /usr/local/vpnserver/vpncmd

VPN Tools>check

All checks passed. It is most likely that SoftEther VPN Server / Bridge can operate normally on this system.

The command completed successfully.

The installation that follows is the most straightforward configuration I’ve come up with. SoftEther can be a little bit tricky, it has a lot of options but so far this has placed my VPN working quite well and using UDP only which is what I was aiming for.

Configuring Server

First off we should change the default access password. Run /usr/local/vpnserver/vpncmd and select option 1. Press enter on all prompts until you have the VPN Server> console. Then run this follwing command.

VPN Server> ServerPasswordSet
VPN Server> HubCreate VPN
VPN Server> Hub VPN
VPN Server> SecureNatEnable
VPN Server> Usercreate (…press enter on all remaining prompts)
VPN Server> Userpasswordset

And that’s it all you need to do on the server side is done.

Install SoftEther client in CentOS

This tutorial will explain how to install SoftEther client in a linux machine. This is pretty straight forward for both debian based distros also. Please check the server part first

  1. First download source code, unpack it and compile
  2. [root@Client home]# wget http://www.softether-download.com/files/softether/v4.05-9416-beta-2014.02.06-tree/Linux/SoftEther%20VPN%20Client/64bit%20-%20Intel%20×64%20or%20AMD64/softether-vpnclient-v4.05-9416-beta-2014.02.06-linux-x64-64bit.tar.gz
    [root@Client home]# tar -zxvf softether-vpnclient-v4.05-9416-beta-2014.02.06-linux-x64-64bit.tar.gz
    [root@Client home/vpnclient]# cd vpnclient
    [root@Client home/vpnclient]# make

    In make select yes on all accounts, otherwise it won’t compile.

  3. Install it
  4. [root@Client home/vpnclient]# mkdir /usr/bin/vpnclient
    [root@Client home/vpnclient]# cp vpn* /usr/bin/vpnclient/
    [root@Client home/vpnclient]# cp hamcore.se2 /usr/bin/vpnclient/
    [root@Client home/vpnclient]# vim /etc/init.d/vpnclient

    In this file make sure you past this source

    #!/bin/sh
    # chkconfig: 2345 99 01
    # description: SoftEther VPN Client
    DAEMON=/usr/bin/vpnclient/vpnclient
    LOCK=/var/lock/subsys/vpnclient
    test -x $DAEMON || exit 0
    case "$1" in
    start)
    $DAEMON start
    touch $LOCK
    ;;
    stop)
    $DAEMON stop
    rm $LOCK
    ;;
    restart)
    $DAEMON stop
    sleep 3
    $DAEMON start
    ;;
    *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
    esac
    exit 0
  5. Start daemon and make sure it will start after a reboot
  6. [root@Client home/vpnclient]# chmod 755 /etc/init.d/vpnclient
    [root@Client home/vpnclient]# service vpnclient start
    SoftEther VPN Client Service Started.
    [root@Client home/vpnclient]# chkconfig --add vpnclient

  7. Configure client
  8. As I stated in the previous server example, this is the best example I’ve come up with. I don’t even know if there’s a better way to do this but there probably is. But for now I’m sticking with what I know that is working quite well.

    Run vpncmd by executing /usr/local/vpnclient/vpncmd and selecting option number 2 and press enter until VPN Client> prompt shows up.

    VPN Client> NicCreate myadapter
    VPN Client> AccountCreate myconnection
    (e.g.Server: serverip:port, Virtual HUB:VPN, Virtual Adaptar: myadapter)
    VPN Client> AccountUsernameSet myconnection
    VPN Client> AccountPasswordSet myconnection
    (set password, choose standard)
    VPN Client> AccountConnect myconnection
    VPN Client> AccountStartupSet myconnection

And that’s it you should be all done. If you have any problems please check the log at /usr/local/vpnclient/client_log/* or vpnserver in case you’re in the server.

I tried using the SecureNat DHCP server but ended up losing all of my clients connections. In order to connect different clients just go to your command line and add the ip address to your adapter like this. Do this in all the clients you setup.

[root@Client home/vpnclient]# ifconfig vpn_myadapter
vpn_myadapter Link encap:Ethernet HWaddr 00:AC:4B:C4:92:82
…..
[root@Client home/vpnclient]# ifconfig vpn_myadapter 172.16.0.3/24
[root@Client home/vpnclient]# ifconfig vpn_myadapter

vpn_myadapter Link encap:Ethernet  HWaddr 00:AC:4B:C4:92:82
          inet addr:172.16.0.3  Bcast:172.16.0.255  Mask:255.255.255.0
          inet6 addr: fe80::2ac:4bff:fec4:9282/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22264 errors:0 dropped:0 overruns:0 frame:0
          TX packets:26073 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:1712919 (1.6 MiB)  TX bytes:1747745 (1.6 MiB)

An example of the account status.

VPN Client>AccountStatusGet
AccountStatusGet command – Get Current VPN Connection Setting Status
Name of VPN Connection Setting: myconnection

Item |Value
——————————————+——————————————
VPN Connection Setting Name |myconnection
Session Status |Connection Completed (Session Established)
VLAN ID |-
Server Name |myserver
Port Number |TCP Port myserverport
Server Product Name |SoftEther VPN Server (64 bit)
Server Version |4.05
Server Build |Build 9416
Connection Started at |2014-02-10 (Mon) 03:06:11
First Session has been Established since |2014-02-10 (Mon) 03:06:13
Current Session has been Established since|2014-02-10 (Mon) 03:06:13
Number of Established Sessions |1 Times
Half Duplex TCP Connection Mode |No (Full Duplex Mode)
VoIP / QoS Function |Disabled
Number of TCP Connections |2
Maximum Number of TCP Connections |2
Encryption |Enabled (Algorithm: RC4-MD5)
Use of Compression |No (No Compression)
Physical Underlay Protocol |VPN over UDP with NAT-T (IPv4)
UDP Acceleration is Supported |Yes
UDP Acceleration is Active |Yes
Session Name |SID-CLIENT1-3
Connection Name |CID-42
Session Key (160 bit) |sessionkey
Bridge / Router Mode |No
Monitoring Mode |No
Outgoing Data Size |1,365,608 bytes
Incoming Data Size |1,396,749 bytes
Outgoing Unicast Packets |17,200 packets
Outgoing Unicast Total Size |1,150,382 bytes
Outgoing Broadcast Packets |7 packets
Outgoing Broadcast Total Size |510 bytes
Incoming Unicast Packets |14,764 packets
Incoming Unicast Total Size |1,130,909 bytes
Incoming Broadcast Packets |913 packets
Incoming Broadcast Total Size |55,674 bytes
The command completed successfully.

How to quickly create a RPM package in CentOS 6.5

Imagine that you want the latest build from your favorite program and you wan’t to keep an installation package whenever you need to revert your virtual machine.

In order to create a RPM package out of a built source you will need checkinstall. This is the easiest and quickest way to create and RPM package. This will keep you from having to compile it everytime you want to use it.

Install rpm handlers:

[root@yourvm home]# yum install -y rpm-build rpmdevtools

After this you will need to create the RPM Source trees

[root@yourvm home]# rpmdev-setuptree

After this step download checkinstall and install it.

[root@yourvm home]# wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/ikoinoba/CentOS_CentOS-6/x86_64/checkinstall-1.6.2-3.el6.1.x86_64.rpm
[root@yourvm home]# rpm -i checkinstall-1.6.2-3.el6.1.x86_64.rpm
warning: checkinstall-1.6.2-3.el6.1.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID f3dbb1a7: NOKEY

After installing checkinstall just run it inside your built tree.

[root@yourvm built_source_tree]# checkinstall --install=no
...
**********************************************************************

 Done. The new package has been installed and saved to

 /root/rpmbuild/RPMS/x86_64/asterisk-1.8.25.0-1.x86_64.rpm
 You can install it in your system anytime using:

      rpm -i asterisk-1.8.25.0-1

**********************************************************************

Run SSH SOCKS server as a daemon in CentOS

This post relies on the previous tutorial on how to quickly setup a SOCKS server.

Again, this is all one in the client side.

First you need to make sure you can autologin to the server acting as the SOCKS server. This is achieved by setting. Make sure you have your own public see so the server can know who you are.

[root@Client ~]# ls .ssh/|grep id
id_rsa
id_rsa.pub

If you don’t have any of these files just create the using the following command. Just press enter on every promtp.

[root@Client ~]# ssh-keygen -t rsa

Then add the autologin to your remote server using this command by changing the server ip to adjust to your scenario.

[root@Client ~]# cat ~/.ssh/id_rsa.pub | ssh user@yourserver ‘cat >> .ssh/authorized_keys’

Now test it by logging in. It should not prompt for any password and go straight to your server console.

[root@Client ~]# ssh user@yourserver
[user@yourserver ~]#

Now that you have the autologin setup, you can set your SOCKS server access by creating an upstart job.
Create a file under /etc/init/socks.conf and paste the following source. Remember to change your user and yourserver ip address to match your current scenario. In this case I’ll setup the SOCKS server in port 443.


# socks - SOCKS server access daemon
#
# This service setups a SOCKS server connection to a specified server
#

start on runlevel [0123456]

stop on runlevel [!$RUNLEVEL]

respwan
respawn limit 15 5
expect fork
exec ssh -v -N -f -D 443 user@yourserver >/tmp/log.log 2>&1

Then just run the upstart command to start your service.

[user@Client ~]# start socks

To make sure the proxy service is running you can use netstat.

[user@Client ~]# start socks
socks start/running, process 1151
[root@socksserver ~]# netstat -tlnp|grep 1151
tcp 0 0 127.0.0.1:443 0.0.0.0:* LISTEN 1151/ssh
tcp 0 0 ::1:443 :::* LISTEN 1151/ssh

And that is all. Whenever your server reboots the service will start automaticly. If the SSH daemon goes down, upstart will restart it,