LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware - ARM (https://www.linuxquestions.org/questions/slackware-arm-108/)
-   -   DVB-T(2)? (https://www.linuxquestions.org/questions/slackware-arm-108/dvb-t-2-a-4175691496/)

pchristy 03-03-2021 11:07 AM

DVB-T(2)?
 
Just a question to see if anyone has played with DVB reception on a Pi? I have been having a play, with varying degrees of success...

I started off using a PCTV USB TripleStick 292E, which I got for my laptop. My "goto" application for DVB is Kaffeine, which compiled without errors on Slarm64. However, whilst it scanned and found all my local DVB channels, it wouldn't actually play them! At best I would occasionally get a few "blocks" of noise, as if the signal level were marginal, but no actual pictures.

My next stop was the DVB utilities. I used dvbv5-scan to get a channels file for my local transmitter, and then used

Code:

dvbv5-zap --lna=1 -c dvb/BeaconHillv5.conf "BBC ONE HD" -r
to tune the DVB stick. I could then use

Code:

mpv /dev/dvb/adapter0/dvr0
to watch it in MPV.

This works flawlessly, and by adding

Code:

-o /path/to/recordings/filename.mts
to the dvbv5-zap command, I can record the program.

This is clumsy, however, as you need two terminals open - one for tuning (dvbv5-zap) and the other for mpv.

Trying to tune mpv directly from Smplayer works, but has a very high cpu useage and is jittery. Trying to tune from VLC using an xspf playlist also doesn't work, producing no output at all - just like Kaffeine. Probably not too surprising, as Kaffeine uses libvlc.

I did wonder if the problem was not being able to enable the lna in Smplayer or VLC, so I invested in a Pi TV uHAT (very cheap on Amazon, at the moment!). This doesn't use an LNA, but exactly the same issues arise.

Raspbian recommend TVHeadend and Kodi. I have used these in the past on x86_64, but TVHeadend needs to be started before Kodi, and needs to be manually terminated after exiting Kodi. And my experiences with Kodi is that it is a pig to compile! I would rather avoid this route if possible!

Has anyone else experimented with this, and found a lighweight solution that works?

Cheers,

--
Pete

justwantin 03-03-2021 02:31 PM

Maybe this will give you some ideas .....

I haven't done this on a SBC but I've been using bash scripts for yonks to save DVB to file either scheduled or real time on my desktop. Scripts offers channel list from channels.conf file then asks for a duration of show, name and start time. They then will create a script that is either run at nominated time using atd or records immediately. Atd runs as a daemon so you can close your terminal.Rrealtime save requires terminal to remain open. My simple script uses tzap and ffmpg. My mre complicated one uses dvbstream which does the encoding on the fly. In the past I set up an nfs share on the directory shows were saved in so my daughter could watch shows I saved/was saving to disc from her box on the lan.

Both scripts create a temporary script to actually save the show and they are overwritten the next time a show is scheduled. The first one below using tzap and ffmpg is the simplest of the two. The second is from the more complicated script which does realtime as well as save and appends a timestamp to the filename. I've been using that one for about 11 years.
Code:

#!/bin/bash
##########################################################
# Created on: Thu Mar  4 06:58:26 AEDT 2021
##########################################################n
tzap -c /etc/channels.conf -r 'ABC NEWS(ABC)' &>/dev/null &
TZAP_PID=$!
ffmpeg -f mpegts -i /dev/dvb/adapter0/dvr0 -y -target pal-dvd -ac 2 /multimedia/abcnews.mpg &>/dev/null &
FMPG_PID=$!
sleep 2m
kill $TZAP_PID
kill $FMPG_PID

Code:

#!/bin/bash
##########################################################
# Created on: Thu Mar  4 07:02:22 AEDT 2021
# This temporary script created when saving dvb shows
# with the script dvb-save. This script is overwritten
# every time dvb-save is run and another dvb-t show is
# scheduled to be saved
######################################################################################

# Declare variables
path=/multimedia
name=sbsone
duration=2m
timestamp=`date +%d-%b-%R`

# Begin giving commands
fuser -k /dev/dvb/adapter0/frontend0
dvbstream -c 0 -qam 64 -cr 3_4 -gi 16 -bw 7 -tm 8 -f 184500 161 81 -ps -o > $path/$name-$timestamp.mpg &
dvbstream_pid=$!
sleep $duration
kill $dvbstream_pid


justwantin 03-03-2021 02:57 PM

Here's another lightweight solution that may give you an idea or two. ... I also set up a realtime dvb player script that uses yad to select channels. I run it with an icon on my desktop. and use a second script with icon to shut down the stream. Select a channel hit ok and mplayer pops up with the dvb stream with audio.
Code:

#!/bin/bash
##############################################################
# /usr/local/watch-dvb RM20180825
# Uses yad to select DVB channel from list and mplayer to
# play stream on desktop.
##############################################################
#
# Make sure that dvb adapter is available
fuser -k /dev/dvb/adapter0/frontend0

#
channel=$(yad  --width "325" --height "525" --center \
        --window-icon "/usr/local/share/icons/tv.png" \
        --text "$first_line_1 \tTo watch DVB TV make a selection." \
        --list --checklist --column " " \
        --button="gtk-close:1"  \
        --button="gtk-ok:0"  \
        --column "                    DVB Channels" --column " " \
        FALSE "C31(C31)" " " \
        FALSE "SBS ONE(SBS)" " " \
        FALSE "SBS TWO(SBS)" " " \
        FALSE "SBS 3(SBS)" " " \
        FALSE "NITV(SBS)" " " \
        FALSE "ABC News 24(ABC)" " " \
        FALSE "ABC1(ABC)" " " \
        FALSE "ABC2 / ABC4(ABC)" " " \
        FALSE "ABC1(ABC)" " " \
        FALSE "ABC3(ABC)" " " \
        FALSE "ABC Dig Music(ABC)" " " \
        FALSE "ABC Jazz(ABC)" " " \
        FALSE "SBS Radio 1(SBS)" " " \
        FALSE "SBS Radio 2(SBS)" " " \
        FALSE "SBS Radio 3(SBS)" " " \
        FALSE "7mate(Seven Network)" " " \
        FALSE "7 Digital(Seven Network)" " " \
        FALSE "Nine Melbourne(Nine Network Australia)" " " \
        FALSE "GEM(Nine Network Australia)" " " \
        FALSE "GO!(Nine Network Australia)" " " \
        FALSE "EXTRA(Nine Network Australia)" " " \
        FALSE "EXTRA 2(Nine Network Australia)" " " \
        FALSE "ONE(Ten Melbourne)" " " \
        FALSE "TEN Digital(Ten Melbourne)" " " \
        FALSE "ONE(Ten Melbourne)" " " \
        FALSE "ELEVEN(Ten Melbourne)" " " \ )
ret=$?
#
if [[ $ret -eq 0 ]]; then
        channel=$(echo "$channel" | awk -F "|" '{print $2}')                                               
        echo "$channel"
        mplayer dvb://"$channel"
fi
#
# Use the command below tocreate a list from /etc/channels.conf
# then edit and order list to suit.
# cat /etc/channels.conf | awk -F ":" '{print "FALSE" " " "\""$1}' | sed -e 's/$/\" \\/'


pchristy 03-04-2021 03:41 AM

Justwantin: Thanks for your comments!

Yes, I too have used scripts - called at a preset time - to record programs using the dvbv5-zap program as outlined above. Your scripts have taken it all a step further, which is great!

What I don't understand is why - for example, Kaffeine - is able to tune the local transmitter whilst scanning, with exactly the same signal strengths and S/N ratios as my x86_64 system (which works perfectly), but is then unable to actually play any of the channels. Same problem with VLC. And why does MPV play dvb perfectly when called directly from the command line, but struggle when called by smplayer?

There is clearly something I'm missing somewhere. Kaffeine and VLC both use libvlc, which is a clue as to why they are not working. There must be something about the way the graphics works on the Pies that is upsetting things.

I don't think its anything to do with hardware decoding, as MPV works fine from the command line. Maybe libvlc amd smplayer are trying to invoke hardware decoding? Smplayer has the video driver set to default - anything else produces a blank output.

Must dig deeper.....

--
Pete

justwantin 03-04-2021 03:48 PM

I haven't used kaffeine/kde or vlc in a very long time. I usually watch what I saved with xine and live with mplayer. Raspbian VLC according to this website has been patched
Quote:

The version of VLC served by the Raspbian package repository has all the required hardware acceleration patches for the Raspberry Pi.
Those patches may be the difference between why Slackwarearm VLC doesn't work for you on a Pi but Raspbian VLC does. Maybe you could grab the Raspbian (now called rpi-os) VLC deb and convert it to a Slackware package. It might work, might not. I rebuilt a webcam server called hawkeye that was developed specifically for running on an rpi and getting it to run properly was a pain in the butt but worth it.

pchristy 03-05-2021 03:15 AM

Thanks for pointing that out! Unfortunately, I'm running Slarm64 (64-bit), and I believe Raspbian is only 32-bit.

As an aside, one of the recent upgrades seems to have broken Mara's version of VLC (compiled for Slarm64). I must find the old thread about this and see if he's published any slackbuilds for it...

I have tried rebuilding VLC using a tweaked script from slackbuilds.org, but it keeps failing for a variety of reasons. I haven't tried AlienBob's version - largely because it is such a huge build! I may give it a go, and leaving it running overnight, if all else fails! ;)

--
Pete

justwantin 03-05-2021 03:57 PM

I had a quick scan through the search results for rpi, 64 bit, vlc, etc. and I had the impression that your vlc problem might be hardware and not software related, in particular video acceleration. All I have here is a couple rpi zero w's and bpros which I run headless so I can't really have a play with this. Please do post again though I'd be interested to see how you get along.

pchristy 03-06-2021 03:30 AM

Quote:

Originally Posted by justwantin (Post 6227703)
I had a quick scan through the search results for rpi, 64 bit, vlc, etc. and I had the impression that your vlc problem might be hardware and not software related, in particular video acceleration.

Depends what you mean by hardware! Both the tuners I have work fine with dvbv5-scan + mpv, but refuse to work with vlc or kaffeine (which is vlc based). I found an article on enabling (and checking) for hardware acceleration, followed the instructions, and it passed the tests. However, that may have been referring to 3D graphics acceleration rather than video decoding. From what I have read there seems to be some kind of licensing issue with Broadcom over video decoding. Everything I've read seems a bit vague, and no real instructions or "how-to's". If I find anything definitive, I'll be sure to post!

The recent upgrades to Slarm64 seemed to break VLC, and I couldn't get it to recompile. I notified sndwvs, and I see he has posted an upgrade for VLC. I'll give that a whirl shortly and see if it helps...

--
Pete

pchristy 03-09-2021 07:42 AM

A little bit of an update on this: I've tracked the VLC problem down to an inability of VLC to play .ts files at present. Sndwvs has been very helpful in compiling the latest version, but for some reason, when I try to compile it, it fails. (See the VLC thread)

I can't play files recorded by my video camera either (also .ts files) in VLC of Kaffeine, although all works fine on x86_64. I'm also enquiring on the VLC forum to see if anyone there has any ideas.

In the meantime, I've managed to simplify viewing and recording under mpv substantially. I've made up a channels.conf file, and put it in the mpv config folder. I can now tune any channel by simply issuing a command such as:

Code:

mpv dvb://"BBC ONE HD"
I can also record by using additional parameters, such as:

Code:

mpv dvb://"BBC ONE S West" --stream-record=Videos/Record/test-1.ts
This is much simpler than my previous method of using dvbv5-zap for tuning and recording, and then running mpv in a separate window to monitor! :)

It also means that I can use something like the "at" command to start recording at a preset time, preceding the mpv command with "timeout 30m" to stop recording after 30 mins (or whatever duration I choose to set).

Not as convenient as Kaffeine, but a good enough workaround until I can get VLC and Kaffeine to play ball!

--
Pete

justwantin 03-11-2021 03:01 PM

I've been following on the your VLC thread. I don't watch much in realtime excepting maybe abc morning news. In the interim why don't you just encode on the fly and watch with Kaffeine or VLC off of the mpg file as it is put to disc. You'd be what seconds ... a minute behind the realtime broadcast. Run your save dvb script via ssh and if it is saved to an nfs share you could watch it from any machine on your lan. I use tzap for below but you could use mpv to do the same thing. Dvbstream encodes on the fly but using it is rather onerous.
Code:

tzap -c /etc/channels.conf -r 'ABC NEWS(ABC)' &>/dev/null &
TZAP_PID=$!
ffmpeg -f mpegts -i /dev/dvb/adapter0/dvr0 -y -target pal-dvd -ac 2 /multimedia/abcnews.mpg &>/dev/null &


pchristy 03-12-2021 03:31 AM

Just put an update in the VLC thread that provides a bit more info, but no cure!

--
Pete


All times are GMT -5. The time now is 09:05 PM.