How Do You Convert Recordings to MP4 for Chromecast

For discussion of topics specific to MythTV on linux
Post Reply
vm_boy
Newcomer
Posts: 3
Joined: Wed May 15, 2019 8:51 pm
United States of America

How Do You Convert Recordings to MP4 for Chromecast

Post by vm_boy »

I have been running MythTV (backend) on a Linux Server for several years now. I access the recordings through Kodi running on a FireTV. While this is a suitable option, I would really like to be able to play my recordings on a Chromecast. I have been poking around the Googles and it seems like the best option is to convert the files to an .mp4. This morning/afternoon I was tinkering with mythtranscode (which I just now figured out how to enable after 5+ years) and I did a test run with an inconsequential recording. It ended creating some .png and .jpg files (which I assume are thumbnails) of a .nuv file (e.g. 1041_1234.ts became 1041_1234.nuv.png, etc.). I didn't actually find the .nuv file and the .ts file is gone, so as far as I am aware, that recording is completely dead, but hey (!!) at least I have some thumbnails. Maybe the .nuv file was saved somewhere else? I have no idea, but apparently, that's not working correctly.

So, could someone please walk me through the process to convert my recordings to MP4 (or perhaps something better) so that I can cast them to a Chromecast. I have looked through this webpage (www.mythtv.org/wiki/Transcode_Video) and I think mythbrake is probably my preferred option, or maybe mythtranscode followed by mythnuv2mkv. I have installed handbrake and mediainfo, but I'm not sure what to do with the mythbrake script. Where do I put it? Then, once I have it where it's supposed to be, I assume I put the command as User Job #1, but what are the options/flags I'm supposed to be using in the command? And most importantly, is this actually going to work? Is there a better option? If the mythtranscode/mythnuv2mkv is the better option, what do I need to do to make that work?

As far as my system specs, I'm running Ubuntu Server 18.04.2 LTS. I have an HDHomeRun Connect Duo (US) tuner.

Thanks :)
Last edited by Steve Goodey on Thu May 16, 2019 6:34 am, edited 1 time in total.
Reason: Amended url link for new user.
daraden
Senior
Posts: 175
Joined: Tue Feb 23, 2016 7:33 am
United States of America

Re: How Do You Convert Recordings to MP4 for Chromecast

Post by daraden »

I have no experience with the scripts you mention, had issues with mythtranscode and a different script years ago and ended up rolling my own script to process recordings. My current process is record with MythTV > edit to mark commercials > Transcode out to mp4 > playback through Emby app on Roku/web browser. Recently picked up a Vizio tv with builtin cast function which I can only seem to get to cast from the Emby app on my phone.

from the mythbrake script

Code: Select all

#USAGE:######################
# This Sript shall be called as a MythTV user job like as follows:
# /path/to/mythbrake.sh "%DIR%" "%FILE%" "%CHANID%" "%STARTTIMEUTC%" "%TITLE%" "%SUBTITLE%" "%CATEGORY%"
that is what the user job should look like. the location of the script is not very important(should technically be in /usr/local/bin) as long as the mythtv user can access it.

Here is the script i was using until about a year ago, when i went full ocd and started writing a full GUI application. https://github.com/daraden/transcode-myth

What software do you plan on using to access the files for casting to the chromecast? I know both Emby and Plex provide this functionality.

Another option if using Emby/Plex would be to use mythlink.pl to make the files accessible with readable names, then have them transcoded on the fly by Emby/Plex. This option would require a lot of processing power or hardware transcoding(i believe this requires a subscription on both Emby and Plex).
vm_boy
Newcomer
Posts: 3
Joined: Wed May 15, 2019 8:51 pm
United States of America

Re: How Do You Convert Recordings to MP4 for Chromecast

Post by vm_boy »

Thanks for the response. I will try to work on some of those things throughout the day today. Yesterday, I figured out how to get the script into /usr/local/bin and make it executable. I will have to go into the backend setup to add the command into the User Job.

For the frontend for casting, I was planning on using MythTV Player for Android. I also have Plex with a lifetime Plex Pass so I could use that, but I don't really like how Plex re-buffers every time you try to skip past commercials.

For the mythlink .pl, should I do that before or after the transcoding? Does it matter?
vm_boy
Newcomer
Posts: 3
Joined: Wed May 15, 2019 8:51 pm
United States of America

Re: How Do You Convert Recordings to MP4 for Chromecast

Post by vm_boy »

I have mythlink .pl and mythbrake .sh in /usr/local/bin and they are executable. I tested mythlink with a file in the command line and it correctly put the symlink into /mnt/pretty. So I know the mythlink script should be working correctly. Mythbrake is a bit more involved so I wasn't able to test that, but I've applied all of my knowledge in dealing with Mythlink and applied it to Mythbrake.

In the User Jobs commands, I have (NOTE: I am putting spaces before .sh and .pl here because the forum thinks it's a link):

User Job 1 ("MythBrake Transcode"):
mythbrake .sh "%DIR%" "%FILE%" "%CHANID%" "%STARTTIMEUTC%" "%TITLE%" "%SUBTITLE%" "%CATEGORY%"

User Job 2 ("File Rename"):
mythlink .pl --link /mnt/pretty --chanid "%CHANID%" --starttime "%STARTTIME%" --format '%T/%T%-%Y%-%m%-%d%-%S'

User Job 3 ("Mythlink Cleanup"):
mythlink .pl --link /mnt/pretty

I have checked the boxes to allow the User Jobs to be run and I have checked the box requiring the jobs to be run on the master backend...otherwise they were just sitting in the queue doing nothing.

So in Mythweb, I went to a recording and set it to run the Mythlink job. I go check the queue. It runs without errors. I go check /mnt/pretty and there is nothing there.

When I run the MythBrake job, the job starts in the queue, but it quickly produces an error: "User Job returned non-zero, check logs." I'm not sure where the log is to figure out what the problem is here.
daraden
Senior
Posts: 175
Joined: Tue Feb 23, 2016 7:33 am
United States of America

Re: How Do You Convert Recordings to MP4 for Chromecast

Post by daraden »

Had not tried MythTV Player for Android, loaded it up this morning. As expected seeking is pretty much nonexistent for mpeg2, to add to that the internal player seems to lack an ac-3 decoder. H.264 with aac works fine though.

Took a look at the Mythbrake script, found a few things that may be issues. Any audio that has more channels than stereo is passed through and not re-encoded. Any video that is considered SD(width 720 or less) is encoded in divix/xvid and not h.264. Then there is HD(width 1280 or greater) is assumed to not have commercials. SD has a hard-coded list of channels without commercials. All other SD content is considered to have commercials and automatically flags the commercials and removes them. Also note this scrip works outside the MythTV database so the new file will not be accessible Through MythTV.

Mythbrake logs too /opt/mythtv/transcodelogs.

With mythlink the first thing i would check is that the mythtv user has write access to the destination directory. Not sure what the second mythlink user job will do since it is not given a format directive.
For the mythlink .pl, should I do that before or after the transcoding? Does it matter?
Generaly after transcoding since the filename should at the very least change from ts to mp4. Since you want to use the MythTV Player for Android it's not even necessary unless you also want to load the recordings into Plex.
Post Reply