DVB search

From MythTV Official Wiki
Revision as of 19:00, 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
#!/bin/sh
for ln in `cat ~/.mplayer/channels.conf `
do
  ch=`echo $ln |awk -F ":" {'print $1'}`
  DATE=`date`
  NEWFILE="$ch.mpg"
  echo "$DATE | $ch start scan.." >> scan.log
  if [ -r nohup.out ]
  then
    rm nohup.out
  fi
  #nohup mencoder -v dvb://[$ch] -o test.mpg -oac copy -ovc copy &
  nohup mencoder -v dvb://[$ch] -o test.mpg -oac copy -ovc lavc &
  for i in 1 2 3
  do
    sleep 10
    mencoder_count=`grep "Found video stream" nohup.out |wc -l`
    if [ $mencoder_count -gt 0 ]
    then
      DATE=`date`
      echo "$DATE | Mencoder Found a Video Stream" >> scan.log
      echo "$ln" >> channels.conf.found
    fi
    if [ -r test.mpg ]
    then
      sleep 15
      break
    fi
    RETURN=`ps aux |grep mencoder |grep -v grep |awk {'print $2'}|wc -l`
    if [[ $RETURN -eq "0" ]]
    then
      break
    fi
  done
  RETURN=`ps aux |grep mencoder |grep -v grep |awk {'print $2'}|wc -l`
  if [[ $RETURN -eq "1" ]]
  then
    kill `ps aux |grep mencoder |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 test.mpg  ]
  then
    echo "$DATE | We gots somthin!" >> scan.log
    mv test.mpg "./found/$NEWFILE"
  else
    echo "$DATE | We gots nothin!" >> scan.log
  fi
#cat nohup.out >> nohup.log 
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
  • the audio and video were garbled for me but there was enough to figure out the channel.

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 .mpg files in ./found/ the file name will correspond to the channel number in channels.conf.found

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

There is an early version of this script that generates jpgs rather than mpgs here [[1]]