Today I have make an initial configuration of Raspberry Pi4 for purpose of streaming an DVB-T live channel via HLS. Basic idea is to use DVB-T USB dongle to receive an MUX with channels. I have used tzap tool to record audio and video PIDs of interested channel. This recording was a source for ffmpeg which transcoded this audio/video data. In final result we got an HLS manifest used by client application.
First step is configuration of HTTP server. I have used a Apache application with enabled directory in user home. Below there is list of commands to do this:
sudo apt-get install apache2 mkdir ~/public_html sudo a2enmod userdir sudo systemctl restart apache2
Next step is scanning of DVB-T channels. I have used w_scan tool. Below there is list of commands to scan DVB-T channels :
sudo apt-get install w-scan mkdir ~/.tzap w_scan -c PL -ft -A1 -X > ~/.tzap/channels.conf
To record an DVB-T channel we could use tzap application. Recorded data is available at following location in system: /dev/dvb/adapter0/dvr0. Below there is example command to do this:
sudo apt-get install dvb_apps tzap -r "channel_name"
Next step is compile of last version of ffmpeg with enabled support for hardware decoding and encoding for H264 codec. We could to it with following commands:
./configure --prefix=$HOME/bin --enable-gpl --enable-nonfree --enable-mmal --enable-omx --enable-omx-pi --arch=armel --target-os=linux make -j4
Then we could start ffmpeg with enabled hardware decoding of input stream and hardware transcoding to achieve given bitrate. Then we are able to start ffmpeg with enabled hardware decoding of input stream and hardware encoding to achieve given bitrate. That made data is segmented and client HLS playlist is created. In attached video there are two examples of ffmpeg configuration for live streaming via HLS of SD and HD DVB-T channels. The performance of hardware decoder/encoder is really good. In case of HD channels transcoding we need to increase size of memory reserved to GPU. In both cases I have used 256 MB for GPU.
Here is video with example of streaming for SD and HD channel with usage of HLS from Raspberry Pi4:
In next attempt I would like to check performance of hardware h265 decoder and usage of external USB3.0 storage, because in this case I have used only internal SD card. Additionally I would like to try to encode multiple variants of the same video stream e.g. in different resolutions in bitrates.