Decoding DVB-S2 using Lean DVB .RAW file record in Ubuntu Sucsess

  • the --sr 2000e3 should change depend of symbol rate you captured and you want to decoding

    like --sr 500 or --sr333 .....

  • MWK

    Changed the title of the thread from “Decoding DVB-S2 using Lean DVB in Ubuntu Sucsess” to “Decoding DVB-S2 using Lean DVB .RAW file record in Ubuntu Sucsess”.


    sudo -s

    echo 32000000 > /proc/sys/fs/pipe-max-size

    first of all we need to install leandvb :

    Download and build leandvb and related utilities:

    git clone -b work

    cd leansdr/src/apps

    vi Makefile # For DVB-S2, find and uncomment LEANSDR_EXTENSIONS so .

    go to leansdr folder then go to src then go to apps , now you find file called makefile ,

    just open it with text editor then uncomment the # in leadsdr_extentions lines .

    then save it then now , go back to terminal then type :


    now after finish you can Run the functional tests. This occasionally reveals

    architecture- or compiler-specific issues.:

    cd leansdr/test

  • the wait it take a time ... after that run this for testing :

    make leandvb-ft


    now ...... Build an external LDPC decoder for DVB-S2 at low SNR:


    git clone -b ldpc_tool

    cd xdsopl-LDPC-pabr

    make CXX=g++ ldpc_tool

    now ....................... Run the error performance tests.:

  • cd leansdr/test

    cp ../../xdsopl-LDPC-pabr/ldpc_tool . (this command copy the ldpc_tool file from xdsopl-LDPC-pabr to leansdr folder)

    (you can copy it manually )

    make leandvb-snr

  • TBD

    Usage: ./leandvb [options] < IQ > TS

    Demodulate DVB-S I/Q on stdin, output MPEG packets on stdout

    Input options:

    --u8 Input format is 8-bit unsigned (rtl_sdr, default)

    --f32 Input format is 32-bit float (gqrx)

    -f HZ Input sample rate (default: 2.4e6)

    --loop Repeat (stdin must be a file)

    Preprocessing options:

    --anf N Number of birdies to remove (default: 1)

    --derotate HZ For use with --fd-pp, otherwise use --tune

    --fd-pp NUM Dump preprocessed IQ data to file descriptor

    DVB-S options:

    --sr HZ Symbol rate (default: 2e6)

    --tune HZ Bias frequency for demodulation

    --standard S DVB-S (default), DVB-S2 (not implemented)

    --const C QPSK (default), 8PSK .. 32APSK (DVB-S2 only)

    --cr N/D Code rate 1/2 (default) .. 7/8 .. 9/10

    --fastlock Synchronize more aggressively (CPU-intensive)

    --filter Filter baseband (CPU-intensive)

    --hq Enable all CPU-intensive features

    UI options:

    -h Display this help message and exit

    -v Output debugging info at startup and exit

    -d Output debugging info during operation

    --fd-info NUM Output demodulator status to file descriptor

    --fd-const NUM Output constellation and symbols to file descr

    --gui Show constellation and spectrum

    --duration S Width of timeline plot (default: 60)

    --linger Keep GUI running after EOF

    Testing options:

    --awgn STDDEV Add white gaussian noise (slow)

  • --inpipe BYTES

    Resize the pipe on standard input.

    Larger values allow the operating system to buffer more samples when leandvb is busy. This is is useful in live streaming mode, especially with jittery LDPC decoding. Buffering increases latency, but the only alternative when the CPU cannot keep up is losing demodulator synchronization.


    Displays the spectrum and I/Q values at various stages in the demodulation process. This is useful for troubleshooting. Available only on platforms with X11. See --fd-info for an alternative monitoring interface.

    -f HZ

    Specifies the sampling rate of the I/Q stream on standard input. Typically this should be the same value as in rtl_sdr -s HZ.

    --sr HZ

    Specifies the symbol rate (a.k.a. baud rate or modulation rate) of the DVB signal. Commonly-used values are 2e6, 1e6, 500e3, 333e3.

    --tune HZ, --derotate HZ

    Specifies the center frequency of the DVB signal in the I/Q stream.

    This option is useful when the carrier frequency error signal is not centered at DC, e.g.:

    When Doppler or inaccurate local oscillators introduce a frequency offset.

    When the receiver is not tuned to the nominal frequency. This is sometimes done deliberately to work around spurious signals or artifacts around DC from low-cost receivers.

    To select a channel from a wideband I/Q capture.

    For example a signal at 397.1 MHz can be received either with rtl_sdr -f 397100000 | leandvb or with rtl_sdr -f 397000000 | leandvb --tune 100e3.

    --derotate explicitly shifts the specified frequency to DC; this is useful with --fd-pp and for troubleshooting with the GUI. --tune merely biases the demodulator instead; this is more CPU-efficient.


    Enables bandpass-filtering and downsampling.

    This is mostly useful with --fd-pp and for troubleshooting with the GUI. Use --sampler rrc instead.

    --decim N

    Enables decimation of the signal prior to demodulation.

    This can reduce CPU usage if the input data is heavily oversampled, but requires a bandpass-filtered signal. If noise or neighbouring signals must be rejected, use --resample or --sampler rrc instead.

    When used in conjunction with --resample, --decim forces the decimation factor. --resample --decim 1 will show the effect of bandpass-filtering in the GUI.

    --sampler MODE

    Selects how symbols are derived from samples.

    nearest: Very fast, but requires a bandpass-filtered signal and a high sampling ratio (e.g. 16 samples per symbol).

    linear: Fast and works at low sampling ratios (e.g. 1.2 samples per symbol), but requires a bandpass-filtered signal and high SNR.

    rrc: Performs bandpass-filtering, interpolation and symbol estimation simultaneously. Best error performance, suitable for all applications, but CPU-intensive. --rrc-rej and --rrc-steps control the filter length and interpolation accuracy. They can be adjusted to improve sensitivity or reduce CPU usage.


    Allows the demodulator to track frequency errors beyond safe boundaries.

    This can be useful with inaccurate oscillators (e.g. non-TCXO RTL-SDR dongles) and in the presence of Doppler shift.

    By default the demodulator tolerates offsets up to ±symbolrate/8. Beyond that, it will deliberately unlock. This is done to avoid locking onto QPSK constellations ±symbolrate/4 away from the correct frequency. With --drift, the demodulator follows the carrier beyond these limits. It will even wrap through band boundaries if the signal is aliased by decimation. The band-pass filters and CNR estimator will follow the drift.

    Note that if the demodulator unlocks after the carrier has drifted significantly from the nominal frequency, it may fail to re-lock, or it may lock at ±symbolrate/4, or it may lock onto a neighbouring signal.


    Enables estimation of the Carrier-to-Noise ratio (C/N). TBD cnr dans

    CNR is obtained by first measuring (C+N)/N from the spectrum, and then deriving C/N.


    Enables more aggressive synchronization techniques.

    With this option leandvb will lock on the signal as early as possible. This is recommended with intermittent signals (half-duplex communications) and in offline mode (to recover as much data as possible from a recorded signal). When used with --viterbi, CPU consumption will increase significantly.


    Enables a special high-throughput mode with the following restrictions:

    8-bit unsigned I/Q input

    No preprocessing (requires a clean bandpass-filtered input signal)

    DVB-S QPSK 1/2 only

    This mode is recommended for HamTV with RTL-SDR dongles on embedded platforms.

    --ldpc-bf INT

    Enables LDPC bit-flipping to correct the specified number of errors.

    This is fast but suboptimal LDPC decoder. Useful to maximize throughput at high SNR.

    --ldpc-helper COMMAND

    Enables LDPC decoding with an external program.

    The program will be spawned as COMMAND --standard DVB-S2 --modcod INT [--shortframes]. It must receive concatenated frames on standard input and emit error-corrected frames (including parity bits) on standard output. LLR format is int8_t. Latency must be less than 32 frames.

    --nhelpers INT

    Specifies the number of external decoder processes.

    This improves throughput on multi-core machines. It is a good idea to try one process per core and see how many are actually busy.

  • Off-line demodulation


    For HamTV signals at 2395 MHz downconverted to 397 MHz by a MMDS LNB with 1998 MHz LO:

    $ rtl_sdr -f 397000000 -s 2400000

    $ ./leandvb --gui --hq < > capture.ts

    $ ffplay capture.ts

    Option --hq enables CPU-intensive features. It is recommended for off-line use, when the goal is to recover as much data as possible.

  • Real-time demodulation


    Conceptually, a live receiver and decoder would be started as follows:

    $ rtl_sdr -f 397000000 -s 2400000 - | ./leandvb --gui | vlc -

    However, this ignores known problems with real-time multimedia streaming:

    At high CPU load, pipes may overflow, in which case the rtl_sdr will silently discard samples. rtl_sdr -b 32768, rtl_sdr -S and leandvb --inbuf 262144 may help.

    Some MPEG players insist on scanning their input stream prior to decoding. The resulting latency can sometimes be reduced by specifying formats and codecs manually on the command-line.

    Most MPEG players will pace video playback by using the output rate of the sound card as a time base, regardless of the actual input data rate. This will unavoidably cause buffer under-runs (leading to audio artifacts) or overruns (causing leandvb to stall due to a blocked output pipe and lose synchronisation). This can sometimes be mitigated by manually specifying a frame rate slightly higher that the real value.

    For interactive applications such as videoconferencing, sources of latency must be understood as well.

    MPEG has provisions for transmitting frames out-of-order, which implies latency. Encoders should be configured to not use backward prediction, i.e. B-frames.

    DVB-S interleaving causes an unavoidable latency of 2244 bytes, i.e. 300 ms at 64 Kbit/s.

    leandvb tends to process data in fixed-size chunks (but the resulting latency should be less than that caused by interleaving).

    Most MPEG decoders will buffer data to ensure a smooth playback.

  • Automatic detection of modulation settings


    The carrier frequency, symbol rate and (for DVB-S) code rate must be supplied to leandvb on the command-line. A companion tool, leansdrscan, can help detect these parameters automatically.

    The following command will spawn leandvb with six combinations of symbol rates (250 kS/s, 500 kS/s, 1000 kS/s) and code rates (1/2, 7/8) until MPEG packets are obtained.

    $ ./leansdrscan -v --rewind ./leandvb -f 1024000 --sr 250000,500000 --cr 1/2,7/8 < > capture.ts

    For live streams the --rewind option is not needed. Besides, the --tune option could be used to scan multiple narrow-band channels within a wide-band capture:

    $ rtl_sdr ... | ./leansdrscan -v ./leandvb -f 2400e3 --tune -500e3,0,500e3 --sr 250000 --cr 1/2,7/8 | ...

    Integration with other software

    leansdr source code is currently not designed to be linked with other software. Instead, third-party applications can spawn a leandvb process, inject I/Q samples into its standard input, and capture its standard output or redirect it into a MPEG decoder. leandvb will provide status information on auxiliary output channels specified by --fd-info and --fd-const.

    $ rtl_sdr ... | ./leansdrscan ./leandvb --fd-info 2 -f 1024e3 --sr 250e3,500e3 --cr 1/2,3/4 | mplayer -cache 128 -

    CR 1/2

    SR 250000.000000

    LOCK 0

    FREQ 4047

    SS 66.660774

    MER 19.8

    LOCK 1

    FREQ 4062

    SS 65.118179

    MER 18.7

    FREQ 4047


  • For example, displays the status information on one line:

    $ rtl_sdr ... | ./ ./leansdrscan ./leandvb --fd-info 2 -f 1024e3 --sr 250e3,500e3 --cr 1/2,3/4 | mplayer -quiet -cache 128 -

    [SS 68] [Offset +4047 Hz] [MER 18.7 dB] [LOCKED] [SR 250000 Hz] [FEC 1/2]

    And shows the constellation and symbols in a 80x24 VT100 terminal:

    $ rtl_sdr ... | ./ ./leandvb --fd-info 2 --fd-const 2 | mplayer -really-quiet -cache 128 -


    leandvb VT100 UI example |


    SS: 63 |

    x x |

    MER: 10.9 dB x x |x x

    x#x x | x# x

    Offset: +188123 Hz | x x


    LOCKED |


    FEC: 1/2 | x

    x x |

    SR: 2000000 Hz x | x x x

    x# | # x

    x x x x x

    x | x





  • Method Two ........ afret install all up , leandvb and LDPC decoder

    sudo sysctl fs.pipe-max-size=4194304

    now open GQRX then put sample rate 2.4 then chose raw then record iq in frequency ( 10.492.500.000 ), and set LNB LO = ( 9750.000.000 )

    just 30 seconds can work or more if you want ..

    after record it go to files then you see it .raw record , just copy it to tmp directory , its from computer you see it

  • now open terminal to put command to decode this raw file :

    ./leandvb --f32 -f 2400e3 --sr 2000e3 --sampler rrc --rrc-rej 30 --standard DVB-S2 --ldpc-helper ldpc_tool -v -d --gui < /tmp/gqrx_20190503_212107_742493900_2400000_fc.raw > /tmp/video.ts

  • the gqrx .raw name up in command change for every .raw file you copy to tmp directory


    Now open new terminal to run mplayer to see video by type :

    mplayer /tmp/video.ts


    well dine !!!!

    Once you have successfully received the video beacon, you can search for actual DATV signals higher in the wideband downlink.

    Optimal SDR settings for decoding these signals have not been validated yet..


  • Live receiver with auto-detection of symbol rate and code rate:

    rtl_sdr -f $DOWNCONVERTED_FREQ -s 2400000 - | ./leansdrscan -v ./leandvb --gui -f 2400e3 --sr 2000e3,1000e3,500e3,250e3 --cr 1/2,2/3,3/4,5/6,7/8 - | mplayer -cache 128 -

    in this case you need to add LDPC helper to command up .