Author |
Message |
loco_hombre
|
Posted: Mon Sep 17, 2007 8:45 pm |
|
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
|
EDITED TO REPRESENT GENERIC VERSION AS RECOMMENDED IN THIS THREAD
Howdy-
Commands changed with IVTV in R5F27. This is a version of the delayed_settings.sh script that reflects the command changes:
/usr/local/bin/delayed_settings.sh
Quote: #!/bin/bash # Uncomment this for debugging #set -vx
DEVICE=$1 exec >>/tmp/changer$DEVICE.log 2>&1
# controls: BRIGHTNESS=${2:-127} # Picture brightness, actually the black level. [0 - 255] HUE=${3:-0} # Hue or color balance. [-128 - 127] SATURATION=${4:-63} # Picture color saturation or chroma gain. [0 - 127] CONTRAST=${5:-63} # Picture contrast or luma gain. [0 - 127] VOLUME=${6:-60000} # Overall audio volume. [0 - 65535]
CTL_OPTS="-d /dev/video$DEVICE" echo ; echo Settings before: /usr/local/bin/v4l2-ctl -d /dev/video$DEVICE --get-ctrl=brightness,hue,saturation,contrast,volume for i in 0 2 4 6 8 10 ; do /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl brightness=$BRIGHTNESS >/dev/null /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl hue=$HUE >/dev/null /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl saturation=$SATURATION >/dev/null /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl contrast=$CONTRAST >/dev/null /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl volume=$VOLUME >/dev/null
# Add any extra ivtvctl commands here, before the sleep. /usr/local/bin/v4l2-ctl --set-audio-input 1 -d /dev/video$DEVICE >/dev/null
sleep 2 done echo ; echo Settings after: /usr/local/bin/v4l2-ctl -d /dev/video$DEVICE--get-ctrl=brightness,hue,saturation,contrast,volume The set audio commands near the end reflect the fact that I have a pvr-150 that needs help with its audio. Quote: /usr/local/bin/v4l2-ctl --set-audio-input 1 -d /dev/video$DEVICE >/dev/null I call this script from my channel change script, in this case, I use directv serial control: /usr/local/bin/change1.plCode: #!/bin/bash # Uncomment this for debugging #set -vx
DEVICE="0" # The PVR-250 card exec >>/tmp/changer$DEVICE.log 2>&1
FREQ_TBL="us-cable" # Possibly "us-cable", "us-cable-hrc", ... BRIGHTNESS=127 # Picture brightness, actually the black level. [0 - 255] HUE=0 # Hue or color balance. [-128 - 127] SATURATION=63 # Picture color saturation or chroma gain. [0 - 127] CONTRAST=63 # Picture contrast or luma gain. [0 - 127] VOLUME=58880 # Overall audio volume. [0 - 65535]
export HOME=/home/mythtv echo "Setting channel to $1" #env /usr/local/bin/d10control1.pl $1 (nohup /usr/local/bin/delayed_settings.sh $DEVICE \ $BRIGHTNESS \ $HUE \ $SATURATION \ $CONTRAST \ $VOLUME & exit) & exit 0 You will need to replace: Quote: /usr/local/bin/d10control1.pl $1 with whatever your channel change command is. Then, you will need to direct your channel change command in mythtv-setup to this script. Also, you need to change the Quote: DEVICE=0 at the beginning of the script to a "1" for your second card channel change script.
A couple of references for these scripts:
http://mysettopbox.tv/phpBB2/viewtopic.php?t=10001&highlight=delayedsettings
http://mysettopbox.tv/phpBB2/viewtopic.php?t=11305&highlight=delayedsettings
-Loco
Last edited by loco_hombre on Sat Sep 29, 2007 6:49 am, edited 14 times in total.
|
|
Top |
|
 |
nlin1996
|
Posted: Tue Sep 18, 2007 8:39 pm |
|
Joined: Sat Sep 16, 2006 4:09 pm
Posts: 53
|
So far so good. I was having the audio problem at least 50% of the time with R5F27 and scheduled recordings. With these scripts I haven't seen one fail yet. Thanks for the help!
I did get the tinny sound once on "watch tv" with live tv. Have you had the problem at all with these scripts?
|
|
Top |
|
 |
loco_hombre
|
Posted: Wed Sep 19, 2007 2:02 am |
|
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
|
I have never had any issues and I have been running similar scripts since R5D1.
If you want to see the IVTV documentation for the commands used in the scripts, you can get the info here under the "UTILITIES" section.
-Loco
|
|
Top |
|
 |
zetoune
|
Posted: Wed Sep 19, 2007 6:03 pm |
|
Joined: Sun Oct 16, 2005 12:15 pm
Posts: 288
|
Your script should'nt be like this ?
Quote: #!/bin/bash # Uncomment this for debugging #set -vx
DEVICE=$1 exec >>/tmp/changer$DEVICE.log 2>&1
# controls: BRIGHTNESS=${2:-127} # Picture brightness, actually the black level. [0 - 255] HUE=${3:-0} # Hue or color balance. [-128 - 127] SATURATION=${4:-63} # Picture color saturation or chroma gain. [0 - 127] CONTRAST=${5:-63} # Picture contrast or luma gain. [0 - 127] VOLUME=${6:-60000} # Overall audio volume. [0 - 65535]
CTL_OPTS="-d /dev/video$DEVICE" echo ; echo Settings before: /usr/local/bin/v4l2-ctl -d /dev/video$DEVICE --get-ctrl=brightness,hue,saturation,contrast,volume for i in 0 2 4 6 8 10 ; do /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl brightness=$BRIGHTNESS >/dev/null /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl hue=$HUE >/dev/null /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl saturation=$SATURATION >/dev/null /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl contrast=$CONTRAST >/dev/null /usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl volume=$VOLUME >/dev/null
# Add any extra ivtvctl commands here, before the sleep. /usr/local/bin/v4l2-ctl --set-audio-input 1 -d /dev/video$DEVICE >/dev/null #/usr/local/bin/v4l2-ctl --set-audio-input 1 -d /dev/video1 >/dev/null
sleep 2 done echo ; echo Settings after: /usr/local/bin/v4l2-ctl -d /dev/video$DEVICE--get-ctrl=brightness,hue,saturation,contrast,volume
|
|
Top |
|
 |
loco_hombre
|
Posted: Wed Sep 19, 2007 6:18 pm |
|
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
|
Good point.
I did mess that up on the settings after line with the $DEVICE. However, I did mean to set both audio devices in my PVR audio fix lines....I just want to make sure that those inputs get set right all of the time.
The script you provided is more appicable to many more people as it is more generic.
I will alter the last line of my posted script....
Thanks!
|
|
Top |
|
 |
zetoune
|
Posted: Wed Sep 19, 2007 6:26 pm |
|
Joined: Sun Oct 16, 2005 12:15 pm
Posts: 288
|
In my case, running this script on my 2nd TV card, makes it mute.
my first one is using svideo and rca as inputs. 2nd one is using the TV tuner.
So I have to run the script just for my 1st card.
Actually, I don't have any audio problem with the second card with TV tuner. Only the first one with RCA audio input. Thank you for your script. I'm gonna see if it fixes the problem for me.
|
|
Top |
|
 |
loco_hombre
|
Posted: Wed Sep 19, 2007 6:36 pm |
|
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
|
I think for the TV tuner you have to set an audio input other than 1. I believe that audio input 1 is the line in....
It looks like it is audio input 0 for the tuner. That might fix the mute issue. But if you have no audio issues for that card there is probably no reason to run this "fix' for it....
Quote: ioctl: VIDIOC_ENUMAUDIO Input : 0 Name : Tuner 1
Input : 1 Name : Line In 1
Input : 2 Name : Line In 2
-Loco
|
|
Top |
|
 |
zetoune
|
Posted: Wed Sep 19, 2007 6:41 pm |
|
Joined: Sun Oct 16, 2005 12:15 pm
Posts: 288
|
|
Top |
|
 |
nlin1996
|
Posted: Fri Sep 21, 2007 6:18 am |
|
Joined: Sat Sep 16, 2006 4:09 pm
Posts: 53
|
I really thought was going to fix the tinny sound problem. At first I had a few typos in the scripts, and was still having the problem because delayed_settings.sh wasn't being called from change1.pl. Now the output in changer0.log looks good, but I'm still getting the tinny sound on about every other recording. Are there any other log files I could look at or any other way to diagnose this? I pasted in all the scripts involved in case anybody sees anything obviously wrong.
Thanks for the help so far.
Setting channel to 300
channel changing 300
Settings before:
brightness: 127
hue: 0
saturation: 0
contrast: 63
volume: 58880
Settings after:
brightness: 127
hue: 0
saturation: 0
contrast: 63
volume: 58880
Here's delayed_settings.sh:
#1/bin/bash
# Uncomment this for debugging
#set -vx
DEVICE=$1
exec >>/tmp/changer$DEVICE.log 2>&1
#controls
BRIGHTNESS=${2:-127} #Picture brightness. actually the balck level. {0 - 255]
HUE=${3:-0} #Hue or color balance [-128 -127]
SATRUATION=${4:-63} #Picture color saturation or chroma gain. [0 -127 ]
CONTRAST=${5:-63} #Picture contrast or luma gain. [0 - 127]
VOLUME=${6:-6000} #Overall audio volume. [0 - 65535]
CTL_OPTS="-d /dev/video$DEVICE"
echo ; echo Settings before:
/usr/local/bin/v4l2-ctl -d /dev/video$DEVICE --get-ctrl=brightness,hue,saturation,contrast,volume
for i in 0 2 4 6 8 10 ; do
/usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl brightness=$BRIGHTNESS >/dev/null
/usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl hue=$HUE >/dev/null
/usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl saturation=$SATURATION >/dev/null
/usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl contrast=$CONTRAST >/dev/null
/usr/local/bin/v4l2-ctl $CTL_OPTS --set-ctrl volume=$VOLUME >/dev/null
#add any extra ivtvctl commands here, before the sleep
/usr/local/bin/v4l2-ctl --set-audio-input 1 -d /dev/video$DEVICE >/dev/null
sleep 2
done
echo ; echo Settings after:
/usr/local/bin/v4l2-ctl -d /dev/video$DEVICE --get-ctrl=brightness,hue,saturation,contrast,volume
Here's change1.pl:
#!/bin/bash
# Uncomment this for debugging
#set -vx
DEVICE="0" # The PVR-250 card
exec >>/tmp/changer$DEVICE.log 2>$1
FREQ_TBL="us-cable" # Possibly "us-cable". "us-cable-hrc". ...
BRIGHTNESS=127 # Picture brightness. actually the black level
HUE=0 # Hue or color balance [-128 - 127]
SATURATION=63 # Picture color saturation or chroma gain. [0 - 127]
CONTRAST=63 # Picture contrast or luma gain. [0 - 127]
VOLUME=58880 # Overall audio vaolume. [0 - 65535]
export HOME=/home/mythtv
echo "Setting channel to $1"
#env
/usr/local/bin/change_channel $1
(nohup /usr/local/bin/delayed_settings.sh $DEVICE \
$BRIGHTNESS \
$HUE \
$SATURATION \
$CONTRAST \
$VOLUME & exit) &
exit 0
Here's my change_channel script:
#!/usr/bin/perl
# make sure to set this string to
# the corresponding remote in /etc/lircd.conf
$remote_name = "blaster";
# Let's assume you don't need to press enter after you punch in a
# channel number. Change this to 1 if your cable box expects you press
# enter after each command
$needs_enter = 0;
# Change this to point to your rc executable
$rc_command = "/usr/bin/irsend";
# This subroutine actually sends the signal to the cable box
sub change_SIGNAL {
my($SIGNAL) = @_;
system ("$rc_command SEND_ONCE $remote_name $SIGNAL");
}
$SIGNAL=$ARGV[0];
open F, ">> /var/log/channel.log";
print F "channel changing $SIGNAL\n";
close F;
print "channel changing $SIGNAL\n";
# Checks if $SIGNAL begins with a digit
# If it detects that the string is made up of digits, then it puts
# spaces between the digits. Ex. 1234 becomes 1 2 3 4
if ( $SIGNAL =~ /^\d+$/ )
{
my $length = length($SIGNAL);
my $counter = 0;
my $temp;
while( $counter < $length )
{
$temp .= substr($SIGNAL,$counter,1) ." ";
$counter++;
}
change_SIGNAL($temp);
}
else
{
# argument we passed was not made up of digits, so it must be a
# command that does something other than channel changing on the
# cable box
change_SIGNAL($SIGNAL);
}
# Do we need to send enter
if ( $needs_enter )
{
system ("$rc_command SEND_ONCE $remote_name ENTER");
}
|
|
Top |
|
 |
kmkittre
|
Posted: Fri Sep 21, 2007 6:47 am |
|
Joined: Tue Jul 12, 2005 8:01 am
Posts: 670
Location:
Salem, MA
|
I'm having a sound problem with the PVR-350. It works for awhile and then it stops working... Could this script help, or is it 150 only?
_________________ LinHES 8.3, 1 BE, 3 FE
|
|
Top |
|
 |
loco_hombre
|
Posted: Fri Sep 21, 2007 6:49 am |
|
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
|
On Change1.pl, at the beginning,make sure that it says, Quote: DEVICE="0" And on Change2.pl, it says, Quote: DEVICE="1" In my scripts, to make sure that I get the audio on both cards fixed, I actually totally replace the Quote: /usr/local/bin/v4l2-ctl --set-audio-input 1 -d /dev/video$DEVICE >/dev/null with direct settings for both cards in both change scripts. Like this:
Code: /usr/local/bin/v4l2-ctl --set-audio-input 1 -d /dev/video0 >/dev/null /usr/local/bin/v4l2-ctl --set-audio-input 1 -d /dev/video1 >/dev/null
-Loco
|
|
Top |
|
 |
loco_hombre
|
Posted: Fri Sep 21, 2007 6:55 am |
|
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
|
This should work with a 150, 250, and 350. However, I do not know if 350 inputs are set the same.....
Depending on available inputs, it culd be altered and used for any capture card.
-Loco
|
|
Top |
|
 |
loco_hombre
|
Posted: Fri Sep 21, 2007 6:57 am |
|
Joined: Wed Feb 01, 2006 12:49 pm
Posts: 42
|
Oh yeah- it does create log files at Quote: /tmp/changer0.log and Quote: /tmp/changer1.log .
Last edited by loco_hombre on Fri Sep 21, 2007 6:57 pm, edited 1 time in total.
|
|
Top |
|
 |
nlin1996
|
Posted: Fri Sep 21, 2007 4:21 pm |
|
Joined: Sat Sep 16, 2006 4:09 pm
Posts: 53
|
Still stumped. I'm only using one PVR150 card and my change1.pl file has DEVICE="0" at the top. I suppose I could go through and hard-code the "video0" everywhere, but I'm not seeing why that would make a difference since the DEVICE="0" is there.
Any idea if I need different ivtv drivers than what's included with R5F27, or did the scripts alone work?
Thanks
|
|
Top |
|
 |
nlin1996
|
Posted: Fri Sep 21, 2007 6:16 pm |
|
Joined: Sat Sep 16, 2006 4:09 pm
Posts: 53
|
This is getting weirder and weirder. I came home to watch some recordings today and noticed every recording from about 2:00 AM on now starts in color and then switches to black and white within about 1 second..
On several of the recordings the sound is tinny at first but then clears up as soon as it goes to black and white.
I noticed I botched the delayed_settings.sh script by defining "SATRUATION" instead of "SATURATION"(see above). That probably explains the black and white symptom.
However, the same scripts were saved and should have been running earlier last night, but must not have been running since those earlier recordings have both the sound problem and are still entirely in color.
Basically, there's no explanation for why the scripts starting running all of a sudden on those post-2:00 AM recordings.
|
|
Top |
|
 |