Upgrade to Ubuntu 18.04 and mythtv 0.29

For discussion of topics specific to MythTV on linux
Post Reply
Posts: 9
Joined: Tue Mar 08, 2016 7:30 pm

Upgrade to Ubuntu 18.04 and mythtv 0.29

Post by njsharp » Wed Jun 20, 2018 6:16 am

I have been rusted on to Ubuntu 16.04 LTS and mythtv 0.28, almost always recording Australian ABC channels 2 (SD) or 20 (HD of same content as 2).
I edit the .ts SD files (MPEG2) (to remove top and tail) and transcode (new profile set up by me with tick on lossless encoding) to remove top, tail, and transmission stuff.
Result is a .ts.old renaming of the original, and a new .mpg file (MPEG2).
I then use handbrake to compact the .mpg to a .mp4 file, usually at least x2 or even x4 compression (depending on content).
I pretend to edit .ts HD files (MPEG4) to learn the frame numbers for start and finish of content, excluding top and tail.
No point in using the transcode as it doesn't work.
I then use mkvtoolkit to trim and compact the .ts to a .mkv file. Small size reduction: just top, tail and perhaps some transmission stuff removed.
BUT this process KEEPS the subtitles.

All files (both types of .ts, .mp4, and .mkv) play perfectly on VLC.


Recently I loaded Ubuntu 18.04 with its mythtv 0.29 on an identical machine. Usual shit fight with mythtv and mysql passwords. Also still had to delay start of mythbackend (just added 20 secs) until tuners initialise (else: all "tuner x has an error").

So far so good. Records nicely and both SD and HD .ts files play back nicely in mythtv. However, HD .ts files have choppy sound in VLC (maybe a VLC problem).
Defined a transcode profile, but less to do now in 0.29 eg no lossless box to tick.
Running transcode on an SD .ts file renames it .ts.old but the new file is named .ts instead of .mpg.
Playing the new .ts file in VLC shows rubbish start and end times, and timer seems not to increment at one sec per sec of content, AND no sound.
(Will try using a supplied transcode next time.)

I am reluctant to record everything in HD (for storage space reasons, and not much point unless (a) I want subtitles (which transcode loses) and/or (b) the content deserves the extra clarity eg nature docos.).

I like Ubuntu 18.04 quite well, compared to the still very nice 16.04. I find mythtv 0.29 itself nicer to install than 0.28. BUT the above issue makes me feel like I probably will keep my media machine on 16.04+0.28 for quite a while unless the issue can be solved.

Your thoughts and experiences?

Regards from Sydney, Australia
Nick Sharp

Posts: 9
Joined: Tue Mar 08, 2016 7:30 pm

Re: Upgrade to Ubuntu 18.04 and mythtv 0.29

Post by njsharp » Sun Jul 01, 2018 12:13 am

Hmmm, many views but no replies. Sigh ...

I was hoping I might read something from a mythtranscode guru eg I would be pleased to learn that I have not set things up properly. It seems to me that the 0.29 transcode now converts mpeg2 to mpeg4, which is nice, but the way I set it up the timings as seen by VLC were screwed up, and the sound and subtitles disappeared.

Well, now I have reached an interim conclusion about how to proceed with 0.29

1 always record in HD (eg from Australian ABC channel 20), that's 1920x1080 and it is already MPEG4, good sound, and subtitles. It may be age or it maybe that actors mumble more than in earlier times, but I occasionally need to turn on subtitles the better to understand content.

2 use mythtv's E feature to note down start and end frames of the content, but without saving as cuts.

3 use mkvtoolnix to cut off top and tail.
Noting the size change even if no top and tail removal is done, I am guessing that TS (Transmission System) overheads are also removed

4 store IF the HD version is desired to be kept

All the above is fast and requires no recoding, so thanks heaps to Handbrake for past MPEG2>MPEG4 services, but farewell.

Modify 2 and 3 if eg an HD commercial channel movie was recorded, to include start and end ad break times, and chop those out.
I have in the past seen some odd things about that, eg frame numbers as seen by mythtv E need *2 before mkvtoolnix.

However, if filing in HD is not required, copy the susbtitles and audio but rescale the video eg (from memory):

ffmpeg -i infile.mkv -scodec copy -acodec copy -vf scale=960:540 outfile.mkv

That gave 300Mb from an original 1Gb. Another option would be scale=1280:720 which is a popular semi-HD size and would probably halve the storage required.

The conversion takes quite a long time, but could be batch scripted to shrink all files in a particular directory, and send the output to another directory prior to filing.

Posts: 9
Joined: Tue Mar 08, 2016 7:30 pm

Re: Upgrade to Ubuntu 18.04 and mythtv 0.29

Post by njsharp » Sat Jul 07, 2018 11:59 pm

Well, I have finally found quite a good solution for recording SDs though I haven't used it much yet.
Australian ABC's SD channel 2 is 720 x 576 resolution using Mpeg2.

I use mythtv's E function to discover the start and end frames for the required content, then feed those into mkvtoolnix (eg as 7464-95164) to cut off top and tail, and it seems remove all the TS stuff, because the reduction in size much exceeds that to be expected from just topping and tailing. EG a one hour content plus 15 mins of top and tail shrank from 2.6Gb to 1.6Gb, nearly 40% down (cf 20% down for just top and tail).

Then I did this:

ffmpeg -i infile.mkv -acodec copy -scodec copy -vcodec libx264 outfile.mkv
which took quite a while! The resulting file was 450Mb, some 70% down from the 1.6Gb of the mpeg2 file.

Playing both files in VLC simultaneously showed no obvious difference in resolution and just a tiny reduction in colour saturation.

Inputting the result back into mkvtoolnix just to see the tracks showed the video now mpeg4, the audio and subtitles unchanged, and puzzlingly several 'tags' entries, about which I know nothing!.. but they do not seem to have any bad effects.

Hope this helps someone

Nick Sharp

Posts: 1
Joined: Mon Jul 23, 2018 11:18 am

Re: Upgrade to Ubuntu 18.04 and mythtv 0.29

Post by emk2203 » Mon Jul 23, 2018 11:29 am

You could try

Code: Select all

ffmpeg -i “infile.mkv” -map 0 -map_metadata 0 -c:v libx265 -crf 24 -preset veryslow -c:a libopus -scodec copy “outfile.mkv”
to see if the results are to your liking.

VLC will play everything you throw at it.

The settings above keep all metadata and structural information, make a HEVC encoding with opus sound format and subtitles intact. They should have good quality compared to the mpeg2 stream.

Post Reply