[mythtv-users] lossless_cut.py and MythTV v31

Stephen Worthington stephen_agent at jsw.gen.nz
Wed Feb 3 09:31:30 UTC 2021


On Tue, 2 Feb 2021 16:02:15 -0800, you wrote:

>I had been using the lossless_cut python scripts to cut commercials out of
>my H264 recordings for some time with MythTV v30 under Ubuntu 16 from the
>mythbuntu repos.
>
>I recently upgraded to Ubuntu 18 and Mythtv v31, and I see that the
>preference there is for python3. I see a couple of possible solution paths.
>
>1. Adapt the scripts to use Python3 and the respective MythTV bindings.
>
>2. Build the MythTV python bindings against python2 and get them installed
>and used.
>
>3. Install a packaged version of the bindings built against python2.
>
>Has anyone taken any of these paths successfully?
>
>I haven't found any other free (as in beer) toolsets that let me cut
>commercials out and preserve the subtitle tracks. So Windows or Linux
>recommendations there are also welcome.
>
>Thank you all in advance.
>-Ray

The preference for Python 3 comes from MythTV v31, not from Ubuntu 18.
It is apparently still possible to compile MythTV v31+ for Python 2
but that option is unloved - it is not available in packages.  Ubuntu
18 has Python 2 as the system default if you have upgraded from an
older Ubuntu.  I am not sure what it installs as a default on a clean
install, but I suspect that is also Python 2.

Since Python 2 is on life support at best, there is no option about
having to upgrade to Python 3 at some point.  My recommendation would
be to get it over with by doing it now.  I have updated all my MythTV
Python programs to Python 3 with my v31 upgrade and found it was not
too difficult.  But I was writing my Python 2 with Python 3 in mind
(using the future library).  What I found was that after running the
2to3 conversion program and fixing the #! line, the things that were
still needing fixing were all in the file I/O where you now need to
explicitly choose whether you are reading the data as binary or as
Unicode text.  Frequently, all that needed doing was to just add a 'b'
character in the open() call to make the I/O binary and that fixed all
the other consequential problems.  Note that I had already installed
Python 3, so you will also need to do that first if it is not already
installed.  I have also since upgraded to 20.04 where Python 3 is the
default.


More information about the mythtv-users mailing list