Hi this also works with the RTL2832U (RTL SDR usb sticks) tested with R820T tuner.
Usage is as follows:
create a common fifo
open one terminal with rtl_fm, writes to fifo:
rtl_fm -f 161975000 -g 40 -p 95 -s 48k -r 48k /tmp/aisdata
open a second terminal with aisdecoder, reads from fifo:
./aisdecoder -h 127.0.0.1 -p 10110 -a file -c mono -d -l -f /tmp/aisdata
using opencpn and configuring a UDP port with IP 0.0.0.0 and port 10110 you can see received AIS positions in realtime.
important usage of rtl_fm:
for second AIS frequency use -f 162025000
fine tune gain parameter (-g ) and most important ppm error ( -p )