[mythtv-users] V4L2 Volume Problem, MythTV 0.29 / Mythbuntu 16.04 / PVR-350 (ivtv)

Ryan Novosielski ryan at novosielski.com
Sun Oct 25 23:35:02 UTC 2020


On Sun, Oct 25, 2020, at 11:33, Stephen Worthington wrote:
> On Sat, 24 Oct 2020 19:34:48 -0400, you wrote:
> 
> >On Sun, Oct 11, 2020, at 00:23, Stephen Worthington wrote:
> >> On Sat, 10 Oct 2020 16:27:20 -0400, you wrote:
> >> 
> >> >Hi all,
> >> >
> >> >I'm replying basically with the same exact problem as this thread:
> >> >
> >> >https://marc.info/?l=mythtv-users&m=158101590515630&w=2
> >> >
> >> >I have recently upgraded from Mythbuntu 14.04 to Mythbuntu 16.04 (yes, lazy; takes awhile to get everything right, and I had to replace my video card after I did), and from Mythbuntu 0.27 (I think) to 0.29. I've started to have the same problem that the other poster reported a few months with his PVR-500 (wasn't a member of the list so couldn't reply to that). When I start up my system, by default, the volume on the PVR-350 is too low:
> >> >
> >> >ryanov at media:/usr/local/bin$ v4l2-ctl --get-ctrl=volume -d /dev/video0
> >> >volume: 52400
> >> >
> >> >Where I seem to want it/where it matches old recordings more or less is volume=63535. I've configured this volume in both /etc/udev.rules.d, which worked, but MythTV resets it somehow, and even in my LIRC channel change script. The problem is that some part of entering "Watch TV" mode on MythTV resets the volume to the above, lower value. I've confirmed that on boot, but before entering "Watch TV," the volume setting is correct. Like I said, I also added it to my channel change script. That works if I enter "Watch TV" and change the channel, but not on the initial channel (and I have to assume, not for recordings either, though I haven't recorded anything since I added it to the change channel script).
> >> >
> >> >It seems like I've narrowed it down to where it is happening. Does anyone have any suggestions about what to do? As the previous poster reported, that particular volume is no longer configurable in mythtv-setup. There are no config options there really anymore. It's not really possible to deal with this problem outside of v4l2, because if I leave that volume alone and raise the system volume, there is some sort of hissing artifact which isn't noticeable until you try to raise the system volume very high on a soft recording. It's also not ideal as I have a lot of old recordings at the "correct" volume.
> >> >
> >> >Understood if the answer is "upgrade," but I don't see anything currently that indicates that updating will change anything about this. 
> >> >
> >> >Thanks in advance for any pointers!
> >> 
> >> The channel change script is run before the recording starts.  When I
> >> had a similar problem with my PVR-500 cards, I found that I had to run
> >> my script after the recording was started.  That way, mythbackend has
> >> done all its setup and you can change the v4l2 settings without having
> >> mythbackend change them back again.  So you need to run your v4l2-ctl
> >> commands in a script run from the EventCmdRecStarted event.  You will
> >> get a few seconds at the start of the recording where the settings are
> >> wrong, before your script has been run, but after that it should work
> >> for the rest of the recording.
> >> 
> >> mythfrontend > Setup > System Event Handlers > Recording started
> >
> >Thanks for your help, but unfortunately that doesn't work either. It does "work," but gets set back to 52400 right away, and apparently gets set that way anytime nearly anything happens.
> >
> >Does anyone have any idea where this value is now getting set? There are very few config parameters anymore for the IVTV-style cards, so there's no place to set this volume in the interfaces, seems like.
> 
> Try looking in the codecparams table.  That seems to have a lot of
> settings for things like that.

Thank you for the further hints.

It really does look like this is all set correctly, but I don't know where these various things are actually used, or actually where in the mythfrontend or mythtv-backend code "Watch TV" actually happens, to see if maybe the source code was modified to make these values meaningless.

mysql> select * from codecparams cp join recordingprofiles rp on cp.profile = rp.id where cp.name like "%vol%";
+---------+----------------+-------+----+--------------+-------------------------+-------------------------+--------------+
| profile | name           | value | id | name         | videocodec              | audiocodec              | profilegroup |
+---------+----------------+-------+----+--------------+-------------------------+-------------------------+--------------+
|       5 | mpeg2audvolume | 90    |  5 | Default      | MPEG-2 Hardware Encoder | MPEG-2 Hardware Encoder |            2 |
|      21 | volume         | 90    | 21 | RTjpeg/MPEG4 | RTjpeg                  | MP3                     |            6 |
|      22 | volume         | 90    | 22 | MPEG2        | RTjpeg                  | MP3                     |            6 |
|       6 | mpeg2audvolume | 90    |  6 | Live TV      | MPEG-2 Hardware Encoder | MPEG-2 Hardware Encoder |            2 |
+---------+----------------+-------+----+--------------+-------------------------+-------------------------+--------------+
4 rows in set (0.00 sec)

To share some more behavior, though, restarting mythtv-backend sets the volume to 63535, where I'd want it (so I've now removed the udev rule since it seems to be unnecessary), and then going into "Live TV," for example, sets the volume back to the lower/undesired 52400 level. The references I see on the web seem to indicate that when these parameters were configurable, 95% was the default volume.

I tried changing all of these to 95 and the behavior is exactly the same: starts up at 63535, starting Live TV sets to 52400, so they don't seem to have any effect any longer.

I have both of these configured as well:

mysql> select * from settings where data like "%v4l%";
+-----------------------+-----------------------------------------------------------------------+----------+
| value                 | data                                                                  | hostname |
+-----------------------+-----------------------------------------------------------------------+----------+
| EventCmdRecStarted    | /usr/bin/v4l2-ctl --set-ctrl=mute=0,volume=63535 --device /dev/video0 | media    |
| EventCmdLivetvStarted | /usr/bin/v4l2-ctl --set-ctrl=mute=0,volume=63535 --device /dev/video0 | media    |
+-----------------------+-----------------------------------------------------------------------+----------+
2 rows in set (0.00 sec)

-- 
  Ryan Novosielski
  ryan at novosielski.com


More information about the mythtv-users mailing list