How to Fix MythTV Analog Volume Too Loud
Summary
This tutorial describes how to reduce the recording volume of an
analog tuner for MythTV.
These steps were documented using Mythbuntu 14.04.1 with MythTV 0.27,
but should also work with other MythTV installations.
Contents
- Problem: MythTV Analog Tuner Recording Volume Too Loud
- Solution: Reduce Analog Tuner Recording Volume with v4l2-ctl Command
- References
Problem: MythTV Analog Tuner Recording Volume Too Loud
The normal procedure for adjusting the recording volume of an analog
tuner is to modify the Volume (%) in the MythTV Backend Recording
Profile for MPEG-2 encoders. Unfortunately this does not always work
as I discovered with a Hauppauge WinTV HVR-2250 MC Dual TV Tuner /
Encoder card.
This problem is evident with the recorded volume being too loud, and
audio is distorted or clipped. It is especially noticeable when both
digital and analog tuners are being used because the analog volume is
significantly louder. For instance when switching from viewing a
digital broadcast to an analog broadcast, the viewer is jolted by the
jarringly loud sound of the analog recording.
Solution: Reduce Analog Tuner Recording Volume with v4l2-ctl Command
The following steps indicate how to list the settings for a tuner card, how to adjust the recording volume for an analog tuner, and how to make these volume settings more permanent.
For reference, on my Hauppauge HVR-2250 dual tuner card (2 analog and 2 digital tuners), the device names are in the following form:
Analog device name: /dev/video# Digital device name: /dev/dvb/adapter#/frontend0
Where the "#" (hash mark or number sign) represents a whole number starting at zero "0".
List Tuner Settings
To list the tuner settings of the first analog tuner, use the
following command:
v4l2-ctl --list-ctrls -d /dev/video0
Output:
brightness (int) : min=0 max=255 step=1 default=127 value=127 flags=slider
contrast (int) : min=0 max=255 step=1 default=66 value=66 flags=slider
saturation (int) : min=0 max=255 step=1 default=62 value=62 flags=slider
hue (int) : min=0 max=255 step=1 default=128 value=128 flags=slider
volume (int) : min=-83 max=24 step=1 default=20 value=0 flags=slider
sharpness (int) : min=0 max=15 step=1 default=8 value=8 flags=slider
stream_type (menu) : min=0 max=1 default=0 value=0 flags=update
video_aspect (menu) : min=0 max=3 default=1 value=1
video_b_frames (int) : min=1 max=3 step=1 default=1 value=1 flags=update
video_gop_size (int) : min=1 max=255 step=1 default=15 value=15
video_bitrate_mode (menu) : min=0 max=1 default=0 value=1 flags=update
video_bitrate (int) : min=1000000 max=6500000 step=100000 default=5000000 value=5000000
video_peak_bitrate (int) : min=1000000 max=6500000 step=100000 default=5000000 value=5000000
From this output we can see that the range of volume values is from -83 to 24, and that the default value is 20.
TIP: v4l2-ctl not installed? |
Set Tuner Volume
The recording volume of the first analog tuner can be set with the
following command:
v4l2-ctl --set-ctrl volume=# -d /dev/video0
Where the "#" (hash mark or number sign) represents a number in the
range -83 to 24.
Through a process of trial and error of setting the recording volume,
recording a TV show and then listening to the TV show, I determined
that an analog tuner recording volume of 4 was about the same loudness
as the recording volume on the digital tuner.
Apply Tuner Settings on MythTV Backend Start / Reboot
To ensure this change takes effect every time the MythTV Backend starts, use the following steps:
- In a terminal window, start a text editor (we'll
use leafpad) to create a file
named mythtv-set-volume.sh in directory /usr/bin.
sudo leafpad /usr/bin/mythtv-set-volume.sh
- Copy and paste the following content into the file
to set the recording volume of each analog tuner.
---------- begin file mythtv-set-volume.sh ----------
#!/bin/sh # Purpose: To set the recording volume of each analog tuner # Called by: MythTV Backend Setup -> System Events -> Master backend started # Parameters: none # # # Set the recording volume of each analog tuner to 4 # for k in /dev/video*; do v4l2-ctl --set-ctrl volume=4 -d $k done
---------- end file mythtv-set-volume.sh ----------
- Save the file and exit the text editor.
- Make the /usr/bin/mythtv-set-volume.sh file
executable.
sudo chmod a+x /usr/bin/mythtv-set-volume.sh
- Start Applications -> System -> MythTV Backend
Setup.
Note that this step is best performed when no recordings are taking place so that recordings in progress are not affected.
- Click Yes to close any currently running mythbackend processes.
- Enter your "pvr" account password.
- Select 8. System Events
- Scroll down to event Master backend started and set
the event to:
/usr/bin/mythtv-set-volume.sh
and Save the setting.
- Press ESC until you exit the MythTV Backend.
- Enter your "pvr" account password to start mythtv-backend.
- Click Yes to run mythfilldatabase.
Congratulations. Your MythTV PVR should now automatically set the analog tuner recording volume on each reboot of the PVR. :-)
References
While learning how to address is the issue of recording volume from an analog tuner being too loud, I found the following references useful: