My MythTV setup has been humming along for years now. It still beats what you can get from cable companies primarily because of the commercial skip capabilities. But there’s also other good stuff like being able to archive a recording. I have previously moved copies of recorded TV to an SD card for portable viewing, for example. For years, I’ve wanted an easy way to make a recorded TV show leave the ephemeral recordings section and move to the video library for permanent storage. Today, I finally got that to happen.
I tried a number of clunky ways of doing this including transcoding but I had many problems. For some reason, none of my transcoding profiles work – the log showed errors with a “255” and something about “HandleDeleteFile”. Apparently the transcoder doesn’t like my recordings. And while I did succeed in getting one to work eventually (I think by changing the output format), it turned it into an NUV file with no sound.
While searching for a process to get me through this, I came across a utility called “lossless_cut”. It’s purpose matches exactly what I want to do: cut out the commercials and save the recording to videos. It requires some set up and some work for each video but it’s not too bad.
First let’s start with the setup. It was pretty easy and fortunately worked with my version of mythtv, 0.24. I followed the instructions in the install from PPA section of the Wiki and only needed to run the three commands:
sudo add-apt-repository ppa:r-d-vaughan/lossless-cut sudo apt-get update sudo apt-get install losslesscut
All of the requirements were already satisfied and worked with my existing install. Whew.
For the setup, I followed the instructions for setting up only the one user job for Export to MythVideo. I’m not planning to save separately (or on the rare occasion that I do, I can use the existing job and just copy the file somewhere). And I didn’t bother with the Keyframe Adjustment job since I’m planning to do the editing manually, anyway. As always, after adding the user job, you need to remember to enable the user job on the page 2 pages before the one where you set up the job – naturally.
Now with the setup complete, the user job is ready to use. After a few tries of running through it, here is the process that works for me. A keyboard is handy for the editing. For more info on the editing process, see the MythTV Wiki page on Editing.
- go to the recording and play it
- while the recording is playing, hit “E” to get into the editor; the playback will pause and show a green bar indicating that there are no cuts
- hit “Z” to load the commercial cut list into the editor and then you’ll see the red sections indicating where the cuts will apply
- edit the cuts – use the up and down arrows to select “cut” and then the left and right arrows to go to the cuts; then use the up and down arrows to select “keyframe” and then the left and right arrows to edit the cut points; use “M” to get the menu and to make the edits; I found that going 2 keyframes after the one that looked right got me the right result in the lossless_cut even though it looked wrong during playback – I don’t know why
- hit “M” and select the bottom choice and then select “Save and Exit” to apply the cuts
- exit the recording playback and go to the Menu and User Job and run the user job for lossless_cut
- when the job finishes, go to Videos and use the Menu to Scan For Changes
- go to the Review folder to find the new video and test it; the instructions say that you can re-run the export and end up with multiple versions but I found that it failed on subsequent attempts if I didn’t delete the prior version first so here is what I do if I need to redo
- go to a terminal window and delete the file in the Review folder; for me, the file was owned by a different user so I needed to sudo to rm it
- back in MythTV, go to Videos, Menu, Scan For Changes
- then repeat the editing starting with step 4 above until step 8 above shows desired results
- in a terminal window, move the file to the desired Videos folder; since the file exported by lossless_cut came through as being owned by a different user, I needed to chown and sudo to mv it
- and back in MythTV, again use the Menu to Scan For Changes
At one point, my Scan For Changes wouldn’t show the new content any more. I found instructions about doing the Scan from the command line and that seemed to fix things.
It is still a bit of a hassle to edit the videos to get them right and made harder by the fact that the editing cuts aren’t where I’d expect them to be. But at least the process of exporting the video from the recordings section is now really easy.