Script to export Mythtv recordings to a folder or NAS

For discussion related to MythTV which doesn't belong in another forum.

Moderator: Forum Moderators

Kwisher
Junior
Posts: 58
Joined: Fri Sep 25, 2015 3:02 pm
United States of America

Re: Script for sending Mythtv recordings to a NAS

Post by Kwisher » Mon Sep 05, 2016 3:21 pm

I've seen at least 2 updates for mythtranscode-utils in the last couple of weeks but this issue still persists.

skinah
Junior
Posts: 53
Joined: Sat Oct 17, 2015 11:56 pm

Re: Script for sending Mythtv recordings to a NAS

Post by skinah » Sun Oct 02, 2016 8:22 am

I just updated the Movie and also the TV Show scripts to do better lossless cuts of HD mp4 recordings. It now uses less HDD space to complete the task, better logging, is faster and has less dependancies. Code is in the first post of this thread. NOTE: if upgrading you need to enter the mythtv backend setup and edit your user job line as it needs extra arguements added. This is due to 0.28 changed from using mpg file extensions to now using .ts extension for the recordings. The new code should run on both older and the latest 0.28

If you try it on 0.27 please post if it does work as I have only tested it in 0.28

The install instructions are commented in the code.

The issue of the recordings being removed in 0.28 I'm testing out a work around which is currently a simple backup of the file and then moving the backup into the right place after the bug removes the file. Seems to work and this has been added into both scripts and will slow things down a little. Will remove this after the bug is fixed but for now this has my setup working great and also with support for mp4 HD recordings.

Kwisher
Junior
Posts: 58
Joined: Fri Sep 25, 2015 3:02 pm
United States of America

Re: Script for sending Mythtv recordings to a NAS

Post by Kwisher » Sun Oct 02, 2016 3:21 pm

Skinah wrote:I just updated the Movie and also the TV Show scripts to do better lossless cuts of HD mp4 recordings. It now uses less HDD space to complete the task, better logging, is faster and has less dependancies. Code is in the first post of this thread. NOTE: if upgrading you need to enter the mythtv backend setup and edit your user job line as it needs extra arguements added. This is due to 0.28 changed from using mpg file extensions to now using .ts extension for the recordings. The new code should run on both older and the latest 0.28

If you try it on 0.27 please post if it does work as I have only tested it in 0.28

The install instructions are commented in the code.

The issue of the recordings being removed in 0.28 I'm testing out a work around which is currently a simple backup of the file and then moving the backup into the right place after the bug removes the file. Seems to work and this has been added into both scripts and will slow things down a little. Will remove this after the bug is fixed but for now this has my setup working great and also with support for mp4 HD recordings.
Thank you, Skinah.

Question: I have two drives/storage locations for recordings. With my existing script I did not have to specify these 2 locations. How can I make your script do the same? i really don't need the fallback copy/move function as I export to the same PC.

Will this work?

Code: Select all

 #The folder where the recordings live, tested with mythbuntu 14.04
    MYTHRECORDINGDIR=/media/mythtv/recordings,/media/myth2/recordings

skinah
Junior
Posts: 53
Joined: Sat Oct 17, 2015 11:56 pm

Re: Script for sending Mythtv recordings to a NAS

Post by skinah » Sun Oct 02, 2016 10:27 pm

I just uploaded a newer version which no longer needs you to supply the recording location so it should work for your situation now. You will need to enter the mythtvbackend setup and adjust the user job line to supply this location. Info on how to setup the script is as always contained in the script at the start. Script is found in the first post of this thread.

Fallback if you do not have a NAS is best thought of as a working or temp folder where the processing is done. Just dont forget to give mythtv user write permissons to the folders and also to ensure enough free space is on the drives.

Lastly a heads up, mythtranscode removing recordings may not be a bug and appears to be an undocumented new feature. Inside mythbackend setup under GENERAL is an option to create a backup file with .OLD this points to this being a feature as you dont add options for bugs :) Both the scripts do their own backups now and work as intended on 0.28 and you do not need to touch that option in the backend setup.

Kwisher
Junior
Posts: 58
Joined: Fri Sep 25, 2015 3:02 pm
United States of America

Re: Script for sending Mythtv recordings to a NAS

Post by Kwisher » Mon Oct 03, 2016 1:26 am

Skinah, thanks so much for your quick response. Your changes work superbly :)

Kwisher
Junior
Posts: 58
Joined: Fri Sep 25, 2015 3:02 pm
United States of America

Re: Script for sending Mythtv recordings to a NAS

Post by Kwisher » Fri Oct 28, 2016 12:56 pm

Skinah wrote:I just uploaded a newer version which no longer needs you to supply the recording location so it should work for your situation now. You will need to enter the mythtvbackend setup and adjust the user job line to supply this location. Info on how to setup the script is as always contained in the script at the start. Script is found in the first post of this thread.

Fallback if you do not have a NAS is best thought of as a working or temp folder where the processing is done. Just dont forget to give mythtv user write permissons to the folders and also to ensure enough free space is on the drives.

Lastly a heads up, mythtranscode removing recordings may not be a bug and appears to be an undocumented new feature. Inside mythbackend setup under GENERAL is an option to create a backup file with .OLD this points to this being a feature as you dont add options for bugs :) Both the scripts do their own backups now and work as intended on 0.28 and you do not need to touch that option in the backend setup.
Skinah, could you please provide instructions to modify your script so that the finished file is not placed into a folder? I have a separate process for moving the files to my nextCloud server to share to family & friends.

Something else I've noticed is that I can't run your script on 2 shows of the same series at the same time. I think it's because the temporary file has the same name (showname - epxsx.xxx) ???

TIA

jctennis
Newcomer
Posts: 1
Joined: Thu Nov 03, 2016 6:14 pm
United States of America

Re: Script for sending Mythtv recordings to a NAS

Post by jctennis » Fri Nov 04, 2016 11:53 am

I am losing a TON of quality with the transcoding being done in this script but I love the renaming and moving features. Space is not much of an issue for me, so I am wondering how I would go about modifying this script to either increase the quality or even remove the re-encoding all together without breaking everything? For the record I am using the Movies script.

skinah
Junior
Posts: 53
Joined: Sat Oct 17, 2015 11:56 pm

Re: Script for sending Mythtv recordings to a NAS

Post by skinah » Wed Nov 09, 2016 4:29 am

If the script is run on a TV Show the compression is far higher than a Movie, so if making the following change to the script keep that in mind that you can choose two different amounts of compression or if you want both to be higher you will need to find both lines that mention Handbrake..

Look for the line that runs Handbrake and change the" -q XX" to a different number other than 21 or whatever its value is. Not sure if a higher or lower number improves the quality but this is how to adjust the quality and it is very simple. Leave the rest alone and just edit that number. Try adding or taking 5 from the number to start with. You could edit the script to not use Handbrake and to simply Move the losscut file instead of deleting it by commenting out the line that deletes the file and also stopping Handbrake from running. The end of the script has a line to clean up the lossless cut file so you can comment out that line to keep it whilst testing to see what you prefer. By looking at the list of recordings in mythweb you can see how large each recording is very easily.

/usr/bin/HandBrakeCLI -i "$FALLBACKDIR/$TVTITLE - $SeasonEpisode.mpg" -o "$FALLBACKDIR/$TVTITLE - $SeasonEpisode.m4v" -e x264 -q 21 -O -r 30 --pfr -x ref=6:bframes=5:vbv-maxrate=62000:vbv-bufsize=62000 -X 720 --decomb --loose-anamorphic --modulus 2 --x264-tune film --x264-preset medium --h264-profile high --h264-level 4.1 -a 1,1 -E copy:ac3,faac -B auto,160 -R auto,auto -6 auto,dpl2 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 -f mp4 >> $FALLBACKDIR/ScriptsLastRun.log

Kwisher
Junior
Posts: 58
Joined: Fri Sep 25, 2015 3:02 pm
United States of America

Re: Script for sending Mythtv recordings to a NAS

Post by Kwisher » Thu Nov 17, 2016 1:24 pm

I would like to delay the running of my transcode job until the wee hours of the morning instead of immediately following the recording end time. From my searching I came across this email thread from the MythTV mail list from 2007:

Code: Select all

* On Sat Mar 03, 2007 at 01:51:26AM -0500, f-myth-users at media.mit.edu wrote:
> See http://cvs.mythtv.org/trac/changeset/12917; cpinkham has obviously
> been following this thread and just checked in some infrastructure
> (but not a complete solution yet).

You never know where I'll popup at.

For the archives, with SVN trunk starting at 12917, you'll be able to make
a simple User Job script that contains this:

----------------------------------------------
#!/bin/sh

echo "INSERT INTO jobqueue (chanid, starttime, inserttime, type, status, \
          statustime, schedruntime, hostname, args, comment, flags) \
        VALUES \
          ($1, $2, now(), 1, 1, now(), DATE_ADD(now(), INTERVAL '7' day), \
          '', '', '', 0);" \
    | mysql -u mythuser -h mythdb -pmythpw mythconverg
----------------------------------------------

Then you'd setup a User Job to run that as:

/path/to/my/schedule_future_transcode_script.sh %CHANID% %STARTTIME%

So we use a User Job to schedule a future mythtranscode job. :)

Type 1 is a transcode job, type 2 is commercial flagging.  Status 1 is
'queued'.

--
Chris
I understand the concept used but I would appreciate some input on getting the code correct.

TIA

skinah
Junior
Posts: 53
Joined: Sat Oct 17, 2015 11:56 pm

Re: Script for sending Mythtv recordings to a NAS

Post by skinah » Sat Nov 19, 2016 12:39 am

the backend setup has a setting that allows you to limit the job queue between set times, that may work for you but the commercial detection may be stopped, not sure, give it a go first as a second option allows the flagging to occur when the recording starts. I let mine run all the time as I want my backend to power down the moment it can to save power. The NAS then provides the recording at a very low power draw when needed to multiple kodi frontends. I have not seen any issues with transcoding whilst 5+ recordings are taking place as I limit the job queue to use low CPU and only 1 job at a time, this is also setup in the mythbackend setup.

For help with that script try posting a new thread as you should get more replies then in this one.

Kwisher
Junior
Posts: 58
Joined: Fri Sep 25, 2015 3:02 pm
United States of America

Re: Script for sending Mythtv recordings to a NAS

Post by Kwisher » Sun Nov 20, 2016 5:29 pm

Skinah wrote:the backend setup has a setting that allows you to limit the job queue between set times, that may work for you but the commercial detection may be stopped, not sure, give it a go first as a second option allows the flagging to occur when the recording starts. I let mine run all the time as I want my backend to power down the moment it can to save power. The NAS then provides the recording at a very low power draw when needed to multiple kodi frontends. I have not seen any issues with transcoding whilst 5+ recordings are taking place as I limit the job queue to use low CPU and only 1 job at a time, this is also setup in the mythbackend setup.

For help with that script try posting a new thread as you should get more replies then in this one.
Tweaking the JobQue time seems to be working so now I have no need for a separate script for scheduling.

New issue: Recordings from my HDHRPrime using Comcast as the source does not work. The log file created by your script shows:

Code: Select all

The line below records the file details of the last run.
ChanID_StartTimeUTC-Title-SeasonAndEpisodeNumber-Subtitle
2351_20161101033000-Impractical Jokers-s0e0-A Day in the Life
DIR/Filename
/media/mythtv2/recordings/2351_20161101033000.ts
2016-11-20 12:23:10.780680 C  mythutil version: fixes/0.28 [v0.28-83-ga55db54] www.mythtv.org
2016-11-20 12:23:10.780694 C  Qt version: compile: 5.5.1, runtime: 5.5.1
2016-11-20 12:23:10.780697 N  Enabled verbose msgs:  general
2016-11-20 12:23:10.780706 N  Setting Log Level to LOG_INFO
2016-11-20 12:23:10.791652 I  Added logging to the console
2016-11-20 12:23:10.792034 I  Setup Interrupt handler
2016-11-20 12:23:10.792043 I  Setup Terminated handler
2016-11-20 12:23:10.792050 I  Setup Segmentation fault handler
2016-11-20 12:23:10.792057 I  Setup Aborted handler
2016-11-20 12:23:10.792063 I  Setup Bus error handler
2016-11-20 12:23:10.792070 I  Setup Floating point exception handler
2016-11-20 12:23:10.792076 I  Setup Illegal instruction handler
2016-11-20 12:23:10.792084 I  Setup Real-time signal 0 handler
2016-11-20 12:23:10.792092 I  Setup Hangup handler
2016-11-20 12:23:10.792162 N  Using runtime prefix = /usr
2016-11-20 12:23:10.792167 N  Using configuration directory = /home/mythtv/.mythtv
2016-11-20 12:23:10.792221 I  Assumed character encoding: en_US.UTF-8
2016-11-20 12:23:10.792453 N  Empty LocalHostName.
2016-11-20 12:23:10.792458 I  Using localhost value of garage
2016-11-20 12:23:10.815249 N  Setting QT default locale to EN_US
2016-11-20 12:23:10.815266 I  Current locale EN_US
2016-11-20 12:23:10.815325 N  Reading locale defaults from /usr/share/mythtv//locales/en_us.xml
Cutlist: 27988-38253,58176-69865,93132-103404
Using mythtranscode to remove cutllist after first creating a backup.
2016-11-20 12:23:16.530677 C  mythtranscode version: fixes/0.28 [v0.28-83-ga55db54] www.mythtv.org
2016-11-20 12:23:16.530692 C  Qt version: compile: 5.5.1, runtime: 5.5.1
2016-11-20 12:23:16.530695 N  Enabled verbose msgs:  general
2016-11-20 12:23:16.530703 N  Setting Log Level to LOG_INFO
2016-11-20 12:23:16.541786 I  Added logging to the console
2016-11-20 12:23:16.542079 I  Setup Interrupt handler
2016-11-20 12:23:16.542086 I  Setup Terminated handler
2016-11-20 12:23:16.542091 I  Setup Segmentation fault handler
2016-11-20 12:23:16.542096 I  Setup Aborted handler
2016-11-20 12:23:16.542101 I  Setup Bus error handler
2016-11-20 12:23:16.542106 I  Setup Floating point exception handler
2016-11-20 12:23:16.542111 I  Setup Illegal instruction handler
2016-11-20 12:23:16.542117 I  Setup Real-time signal 0 handler
2016-11-20 12:23:16.542123 I  Setup Hangup handler
2016-11-20 12:23:16.542179 N  Using runtime prefix = /usr
2016-11-20 12:23:16.542182 N  Using configuration directory = /home/mythtv/.mythtv
2016-11-20 12:23:16.542224 I  Assumed character encoding: en_US.UTF-8
2016-11-20 12:23:16.542532 N  Empty LocalHostName.
2016-11-20 12:23:16.542542 I  Using localhost value of garage
2016-11-20 12:23:16.566922 N  Setting QT default locale to EN_US
2016-11-20 12:23:16.566934 I  Current locale EN_US
2016-11-20 12:23:16.566980 N  Reading locale defaults from /usr/share/mythtv//locales/en_us.xml
2016-11-20 12:23:16.642685 I  Loading en_us translation for module mythfrontend
2016-11-20 12:23:16.644797 N  Transcoding from /media/mythtv2/recordings/2351_20161101033000.ts to /home/mythtv/Impractical Jokers - s0e0.mpg
2016-11-20 12:23:16.644807 I  Honoring the cutlist while transcoding
2016-11-20 12:23:16.647817 I  Opening /media/mythtv2/recordings/2351_20161101033000.ts
2016-11-20 12:23:16.668824 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.668999 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669004 I  decode_slice_header error
2016-11-20 12:23:16.669010 I  no frame!
2016-11-20 12:23:16.669029 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669060 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669067 I  decode_slice_header error
2016-11-20 12:23:16.669073 I  no frame!
2016-11-20 12:23:16.669104 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669135 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669139 I  decode_slice_header error
2016-11-20 12:23:16.669144 I  no frame!
2016-11-20 12:23:16.669162 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669191 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669195 I  decode_slice_header error
2016-11-20 12:23:16.669199 I  no frame!
2016-11-20 12:23:16.669214 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669240 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669244 I  decode_slice_header error
2016-11-20 12:23:16.669250 I  no frame!
2016-11-20 12:23:16.669264 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669287 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669291 I  decode_slice_header error
2016-11-20 12:23:16.669297 I  no frame!
2016-11-20 12:23:16.669327 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669355 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669359 I  decode_slice_header error
2016-11-20 12:23:16.669365 I  no frame!
2016-11-20 12:23:16.669379 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669407 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669411 I  decode_slice_header error
2016-11-20 12:23:16.669415 I  no frame!
2016-11-20 12:23:16.669464 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669488 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669492 I  decode_slice_header error
2016-11-20 12:23:16.669497 I  no frame!
2016-11-20 12:23:16.669510 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669533 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669537 I  decode_slice_header error
2016-11-20 12:23:16.669542 I  no frame!
2016-11-20 12:23:16.669587 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669632 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669636 I  decode_slice_header error
2016-11-20 12:23:16.669642 I  no frame!
2016-11-20 12:23:16.669654 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669684 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669688 I  decode_slice_header error
2016-11-20 12:23:16.669692 I  no frame!
2016-11-20 12:23:16.669709 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669733 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669737 I  decode_slice_header error
2016-11-20 12:23:16.669741 I  no frame!
2016-11-20 12:23:16.669759 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669778 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669782 I  decode_slice_header error
2016-11-20 12:23:16.669787 I  no frame!
2016-11-20 12:23:16.669807 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669830 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669834 I  decode_slice_header error
2016-11-20 12:23:16.669841 I  no frame!
2016-11-20 12:23:16.669867 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669893 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669897 I  decode_slice_header error
2016-11-20 12:23:16.669900 I  no frame!
2016-11-20 12:23:16.669914 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669934 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.669938 I  decode_slice_header error
2016-11-20 12:23:16.669943 I  no frame!
2016-11-20 12:23:16.669985 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670006 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670010 I  decode_slice_header error
2016-11-20 12:23:16.670015 I  no frame!
2016-11-20 12:23:16.670033 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670064 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670073 I  decode_slice_header error
2016-11-20 12:23:16.670082 I  no frame!
2016-11-20 12:23:16.670112 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670141 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670146 I  decode_slice_header error
2016-11-20 12:23:16.670149 I  no frame!
2016-11-20 12:23:16.670168 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670203 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670207 I  decode_slice_header error
2016-11-20 12:23:16.670212 I  no frame!
2016-11-20 12:23:16.670226 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670247 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670251 I  decode_slice_header error
2016-11-20 12:23:16.670257 I  no frame!
2016-11-20 12:23:16.670271 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670292 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670296 I  decode_slice_header error
2016-11-20 12:23:16.670302 I  no frame!
2016-11-20 12:23:16.670331 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670357 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670361 I  decode_slice_header error
2016-11-20 12:23:16.670365 I  no frame!
2016-11-20 12:23:16.670379 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670420 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670425 I  decode_slice_header error
2016-11-20 12:23:16.670431 I  no frame!
2016-11-20 12:23:16.670447 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670474 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670480 I  decode_slice_header error
2016-11-20 12:23:16.670486 I  no frame!
2016-11-20 12:23:16.670501 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670527 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670531 I  decode_slice_header error
2016-11-20 12:23:16.670538 I  no frame!
2016-11-20 12:23:16.670590 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670612 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670616 I  decode_slice_header error
2016-11-20 12:23:16.670618 I  no frame!
2016-11-20 12:23:16.670645 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670665 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670669 I  decode_slice_header error
2016-11-20 12:23:16.670673 I  no frame!
2016-11-20 12:23:16.670685 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670704 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670707 I  decode_slice_header error
2016-11-20 12:23:16.670713 I  no frame!
2016-11-20 12:23:16.670723 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670746 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670749 I  decode_slice_header error
2016-11-20 12:23:16.670756 I  no frame!
2016-11-20 12:23:16.670769 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670790 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670793 I  decode_slice_header error
2016-11-20 12:23:16.670797 I  no frame!
2016-11-20 12:23:16.670823 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670845 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.670848 I  decode_slice_header error
2016-11-20 12:23:16.670854 I  no frame!
2016-11-20 12:23:16.670936 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.671009 I  non-existing PPS 0 referenced
2016-11-20 12:23:16.671012 I  decode_slice_header error
2016-11-20 12:23:16.671016 I  no frame!
2016-11-20 12:23:16.715264 I  PES packet size mismatch
2016-11-20 12:23:16.715288 I  Input #0, mpegts, from '/media/mythtv2/recordings/2351_20161101033000.ts':
2016-11-20 12:23:16.715298 I    Duration: 00:31:15.20, start: 94597.251322, bitrate: 3704 kb/s
2016-11-20 12:23:16.715336 I      Stream #0:0[0x1760]: Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
2016-11-20 12:23:16.715354 I      Stream #0:1[0x1761](eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
2016-11-20 12:23:16.715466 W  Warning: partial frame found!
2016-11-20 12:23:18.082204 E  No more queue slots!
2016-11-20 12:23:18.101950 E  Transcoding /media/mythtv2/recordings/2351_20161101033000.ts failed
2016-11-20 12:23:18.104668 N  Deleting /media/mythtv2/recordings/2351_20161101033000.ts.tmp
2016-11-20 12:23:18.105152 N  Requesting delete for file 'myth://Default@garage/2351_20161101033000.ts.tmp'.
2016-11-20 12:23:18.107284 I  MythCoreContext::ConnectCommandSocket(): Connecting to backend server: 10.1.0.10:6543 (try 1 of 1)
2016-11-20 12:23:18.108335 I  MythCoreContext::CheckProtoVersion(): Using protocol version 88 XmasGift
2016-11-20 12:23:18.110356 N  Deleting file '/media/mythtv2/recordings/2351_20161101033000.ts.tmp'.
File must be a mp4 recording as we can not do lossless transcoding with mythtranscode
The cutlist is:
-27988 38253-58176 69865-93132 103404-
clipcount=1
Start=0-End=27988
clipcount=2
Start=38253-End=58176
clipcount=3
Start=69865-End=93132
The keepframes string contains:0-27988,+38253-58176,+69865-93132
Using mkvmerge to create a single file without pieces from the cutlist
Mediainfo shows this about the file:

Code: Select all

General
ID                                       : 7 (0x7)
Complete name                            : 2351_20161101033000.ts
Format                                   : MPEG-TS
File size                                : 828 MiB
Duration                                 : 31mn 14s
Overall bit rate mode                    : Variable
Overall bit rate                         : 3 706 Kbps
Movie name                               : Jon Glaser Loves Gear, Cycling
Law rating                               : TV-14 (DL)

Video
ID                                       : 5984 (0x1760)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.2
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : 27
Duration                                 : 17mn 8s
Bit rate mode                            : Constant
Bit rate                                 : 3 135 Kbps
Nominal bit rate                         : 20.0 Mbps
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 59.940 (60000/1001) fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.057
Stream size                              : 384 MiB (46%)
EBP_Distance                             : 2.000
EBP_Mode                                 : Explicit

Audio
ID                                       : 5985 (0x1761)
Menu ID                                  : 1 (0x1)
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : 129
Duration                                 : 31mn 14s
Bit rate mode                            : Constant
Bit rate                                 : 384 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Frame rate                               : 31.250 fps (1536 spf)
Compression mode                         : Lossy
Delay relative to video                  : -1s 40ms
Stream size                              : 85.8 MiB (10%)
Language                                 : English

Text #1
ID                                       : 5984 (0x1760)-CC1
Menu ID                                  : 1 (0x1)
Format                                   : EIA-608
Muxing mode                              : SCTE 128 / DTVCC Transport
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 17mn 8s
Bit rate mode                            : Constant
Stream size                              : 0.00 Byte (0%)

Text #2
ID                                       : 5984 (0x1760)-CC3
Menu ID                                  : 1 (0x1)
Format                                   : EIA-608
Muxing mode                              : SCTE 128 / DTVCC Transport
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 17mn 8s
Bit rate mode                            : Constant
Stream size                              : 0.00 Byte (0%)

Text #3
ID                                       : 5984 (0x1760)-1
Menu ID                                  : 1 (0x1)
Format                                   : EIA-708
Muxing mode                              : SCTE 128 / DTVCC Transport
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 17mn 8s
Bit rate mode                            : Constant
Stream size                              : 0.00 Byte (0%)

Text #4
ID                                       : 5984 (0x1760)-2
Menu ID                                  : 1 (0x1)
Format                                   : EIA-708
Muxing mode                              : SCTE 128 / DTVCC Transport
Muxing mode, more info                   : Muxed in Video #1
Duration                                 : 17mn 8s
Bit rate mode                            : Constant
Stream size                              : 0.00 Byte (0%)

Menu
ID                                       : 61 (0x3D)
Menu ID                                  : 1 (0x1)
Duration                                 : 31mn 14s
List                                     : 5984 (0x1760) (AVC) / 5985 (0x1761) (AC-3, English)
Title                                    : Jon Glaser Loves Gear, Cycling
Language                                 :  / English
Law rating                               : TV-14 (DL)
If you need the source file let me know and i will share it somehow.

skinah
Junior
Posts: 53
Joined: Sat Oct 17, 2015 11:56 pm

Re: Script for sending Mythtv recordings to a NAS

Post by skinah » Fri Nov 25, 2016 11:13 pm

Try this line manually in a terminal session as it seems to have crashed or stopped at this point, you just need to edit it to have your correct output location in case it is a folder permission causing it make sure it is the same location. It may be something as simple as you have run out of HDD space..

mkvmerge --split parts-frames:0-27988,+38253-58176,+69865-93132,+103404-1000000 -o "$FALLBACKDIR/Impractical Jokers.mkv" "/media/mythtv2/recordings/2351_20161101033000.ts"

skinah
Junior
Posts: 53
Joined: Sat Oct 17, 2015 11:56 pm

Re: Script for sending Mythtv recordings to a NAS

Post by skinah » Sat Nov 26, 2016 2:07 am

I found a few bugs which are now fixed in the very first post of this thread.
Bugs were only in MP4 processing and were causing the cuts to occur in the wrong places and missing ends.
To upgrade make sure you are using MKVMERGE version 9.5 or newer and BC is installed, instructions are in the start of the script. Found I was using a very old version of mkvmerge 6.x until I added the correct source and key. These changes may fix your issues Kwisher.

jfabernathy
Senior
Posts: 107
Joined: Wed Feb 18, 2015 2:37 pm
United States of America

Re: Script for sending Mythtv recordings to a NAS

Post by jfabernathy » Sun Nov 27, 2016 6:37 pm

Skinah,

I have been using your original TV show script in Mythtv 0.27 successfully for about a year. Didn't work in 0.28 due to a mythtranscode bug that has now been fixed, so I stayed on 0.27. I've been testing 0.28 now with the fixes and I can confirm that the original TV Show script works in 0.28 with the latest fixes. The only change I made was to use .ts instead of .mpg, but I don't think that was required.

So I've seen some changes you have made mostly for the Movies script. I'm planing on just using the original TV Show Script unless you think I'm missing something I should know about.

Comments??

skinah
Junior
Posts: 53
Joined: Sat Oct 17, 2015 11:56 pm

Re: Script for sending Mythtv recordings to a NAS

Post by skinah » Sun Nov 27, 2016 11:32 pm

jfabernathy wrote:Skinah,
I've been testing 0.28 now with the fixes and I can confirm that the original TV Show script works in 0.28 with the latest fixes. So I've seen some changes you have made mostly for the Movies script. I'm planing on just using the original TV Show Script unless you think I'm missing something I should know about.
Comments??
Thanks for the heads up that the bug with mythtranscode is fixed in 0.28, I put a work around in the script which backs up the recording so if this is no longer needed I'll pull that out next time I make a change.

I would recommend you upgrade to the latest version of the script if you:
Use multiple HDD for storing the myth recordings. As previously the recording location was hard coded in the script.
Have MP4 recordings as previously it only worked for mp2 streams.
Use 0.28 as the recordings changed from .mpg to .ts files, this was updated.

Otherwise if its not broken, don't fix it.

I prefer to use both scripts but either one can detect and process a TV SHow if the recording has a Season and Episode number stored in the database. The first post of this thread goes into more detail as to why there is two and the difference in the files that it outputs.

Most of the changes made in the last year were to get lossless cuts in MP4 streams as mythtranscode can not do this AFAIK.

Post Reply