DVB search

From MythTV Official Wiki
Revision as of 16:09, 4 April 2006 by Ll (Talk | contribs)

Jump to: navigation, search

While following the directions in Adding QAM Channels For HDTV Tuner Cards I ran into a few problems.

./dvbscan atsc/us-Cable-Standard-center-frequencies-QAM256 

returned over 200 channels, none of them had useable names, and the names would often repeat..

Example

[0006]:657000000:QAM_256:74:75:6
[000c]:657000000:QAM_256:0:80:12
[0001]:657000000:QAM_256:76:77:1
[0005]:663000000:QAM_256:0:65:5
[0006]:663000000:QAM_256:0:77:6
[0002]:663000000:QAM_256:0:68:2
[000b]:663000000:QAM_256:74:75:11
[000c]:663000000:QAM_256:72:73:12
.
.
[003d]:735000000:QAM_256:237:238:61
[0002]:741000000:QAM_256:0:72:2
[0006]:741000000:QAM_256:66:67:6
[0008]:741000000:QAM_256:74:75:8
[0009]:741000000:QAM_256:64:65:9
[000c]:741000000:QAM_256:0:78:12
[000a]:741000000:QAM_256:88:89:10

.. also ..

mplayer -vo jpeg:quality=95 -frames 2 -nosund dvb://[channel name]

Would run usually 'forever' and not return anything of use...

The following is the way that I worked around these problems...

First we have to 'fix' the channels.conf to use names that do not repeat.

This can be done using the following script.

fixnames.sh:

#!/bin/sh
COUNT=1
for ln in `cat channels.conf `
do
  CHAN=`echo "$ln" | awk -F "]" {'print $2'}`
  echo "$COUNT$CHAN" >>channels.conf.new

  COUNT=`echo "$COUNT + 1" | bc`
done

channels.conf.new should look something like this..

1:555000000:QAM_256:20:21:19
2:555000000:QAM_256:26:27:20
3:567000000:QAM_256:16:17:91
4:567000000:QAM_256:20:21:89
5:567000000:QAM_256:30:31:99
6:609000000:QAM_256:0:65:7
7:609000000:QAM_256:88:89:3
8:609000000:QAM_256:97:98:4
9:609000000:QAM_256:0:68:9

copy channels.conf.new to ~/.mplayer/channels.conf (if you are the cautious type, back up your old ~/.mplayer/channels.conf)

Next we will want to search all of the channels using the following script.

scan.sh:

#!/bin/sh
for ch in `cat ~/.mplayer/channels.conf |awk -F ":" {'print $1'}`
do
  DATE=`date`
  NEWFILE="$ch.jpg"
  echo "$DATE | $ch start scan.." >> scan.log
  nohup mplayer -vo jpeg:quality=95 -frames 2 -ao null dvb://[$ch]  &
  for i in 1 2 3 4 5 6 7 8 9 10 11 12
  do
    sleep 10
    if [ -r 00000001.jpg ]
    then
      break
    fi
  done
  RETURN=`ps aux |grep mplayer |grep -v grep |awk {'print $2'}|wc -l`
  if [[ $RETURN -eq "1" ]]
  then
    kill `ps aux |grep mplayer |grep -v grep |awk {'print $2'}`
    DATE=`date`
    echo "$DATE | $ch was killed! " >> scan.log
  else
    DATE=`date`
    echo "$DATE | $ch ended! " >> scan.log
  fi
  DATE=`date`
  echo "$DATE | $ch end scan.." >> scan.log
  if [ -r 00000001.jpg  ]
  then
    echo "$DATE | We gots somthin!" >> scan.log
    mv 00000001.jpg "./found/$NEWFILE"
  else
    echo "$DATE | We gots nothin!" >> scan.log
  fi
sleep 5
done

notes:

  • make sure that you have a ./found/ directory to store the found images
  • make sure that you are not running more than one instance of mplayer

Depending on how many channels you have this is going to take a while... Take this opportunity to spend some time with your wife... I know that mine appreciated it.

When its complete with any luck you should have a series of .jpg files in ./found/ the file name will correspond to the channel number in ~/.mplayer/channels.conf

From there you can trim down your channels.conf and follow the directions found in Adding QAM Channels For HDTV Tuner Cards

Let me know if this helps or if you have any suggestions. User_talk:Ll