Mailing List Archive

Update recording file name from command line?
I still use a combined FE/BE in the living room but everywhere else I use
either a Roku, Roku TV, and stream via Plex.

Some channels work find but others have issues with audio sync. It seems
like the video freezes right at the beginning but the audio does not so it
stays out of sync.

I've played around, especially on Plex and forcing it to transcode on the
fly usually works but reduced video quality and the audio is changed from
multi-channel to stereo so it's not an ideal solution.

I noticed that recordings I've saved to videos via Avidemux to MKV
container (video and audio are copied) don't have this problem so I was
thinking of using mkvmerge in a transcode user job to move all my
recordings from TS to MKV container formats.

I plan to write a bash script around this but how do I go about updating
the name of the recording in the database? Mythutil seems an obvious
candidate to have this functionality but it doesn't as far as I can tell.

Ideas?

Thanks,
Richard
Re: Update recording file name from command line? [ In reply to ]
On 17/12/2018 16:49, Richard Shaw wrote:
> I still use a combined FE/BE in the living room but everywhere else I
> use either a Roku, Roku TV, and stream via Plex.
>
> Some channels work find but others have issues with audio sync. It seems
> like the video freezes right at the beginning but the audio does not so
> it stays out of sync.
>
> I've played around, especially on Plex and forcing it to transcode on
> the fly usually works but reduced video quality and the audio is changed
> from multi-channel to stereo so it's not an ideal solution.
>
> I noticed that recordings I've saved to videos via Avidemux to MKV
> container (video and audio are copied) don't have this problem so I was
> thinking of using mkvmerge in a transcode user job to move all my
> recordings from TS to MKV container formats.
>
> I plan to write a bash script around this but how do I go about updating
> the name of the recording in the database? Mythutil seems an obvious
> candidate to have this functionality but it doesn't as far as I can tell.
>
> Ideas?
>
> Thanks,
> Richard

Watch Recordings > highlight > Menu > Recording Options > Change
Recording Metadata

lets you do it from the frontend - but not in 'Previously recorded,'
IIRC. I don't know if that helps...

John
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Update recording file name from command line? [ In reply to ]
On Mon, Dec 17, 2018 at 12:08 PM John Pilkington <johnpilk222@gmail.com>
wrote:

>
> Watch Recordings > highlight > Menu > Recording Options > Change
> Recording Metadata
>
> lets you do it from the frontend - but not in 'Previously recorded,'
> IIRC. I don't know if that helps...


Well interesting since I didn't know you could do that but doesn't help
from a User Job / command line POV...

Thanks,
Richard
Re: Update recording file name from command line? [ In reply to ]
On 12/17/18 12:26 PM, Richard Shaw wrote:
> On Mon, Dec 17, 2018 at 12:08 PM John Pilkington <johnpilk222@gmail.com <mailto:johnpilk222@gmail.com>> wrote:
>
>
> Watch Recordings > highlight > Menu > Recording Options > Change
> Recording  Metadata
>
> lets you do it from the frontend - but not in 'Previously recorded,'
> IIRC.  I don't know if that helps...
>
>
> Well interesting since I didn't know you could do that but doesn't help from a User Job / command line POV...
>
> Thanks,
> Richard

Not pushed yet, but working on it for v30.0. So far the commit message will read
(and these have all been tested):

Services API: Adds Dvr/UpdateRecordedMetadata

Parameters. The 1st is required and at least one optional
parameter must be supplied or the endpoint returns false:

RecordedId uint, selects the recording to update

AutoExpire true/false
BookmarkOffset uint
BookmarkOffsetType position, duration or not even sent
(requires BookmarkOffset)
Damaged true/false
Description string
Episode uint
Inetref string
OriginalAirDate yyyy/mm/dd
Preserve true/false
Season uint
Stars 0-10
SubTitle string
Title string <---------------------------
Watched true/false

Dvr/SetSavedBookmark and Dvr/UpdateWatchedStatus will log a
warning announcing that they're deprecated.

This too doesn't change the title in oldrecorded.

--
Bill
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Update recording file name from command line? [ In reply to ]
On 12/17/18 11:49 AM, Richard Shaw wrote:
> I still use a combined FE/BE in the living room but everywhere else I
> use either a Roku, Roku TV, and stream via Plex.
>
> Some channels work find but others have issues with audio sync. It
> seems like the video freezes right at the beginning but the audio does
> not so it stays out of sync.
>
> I've played around, especially on Plex and forcing it to transcode on
> the fly usually works but reduced video quality and the audio is
> changed from multi-channel to stereo so it's not an ideal solution.
>
> I noticed that recordings I've saved to videos via Avidemux to MKV
> container (video and audio are copied) don't have this problem so I
> was thinking of using mkvmerge in a transcode user job to move all my
> recordings from TS to MKV container formats.
>
> I plan to write a bash script around this but how do I go about
> updating the name of the recording in the database? Mythutil seems an
> obvious candidate to have this functionality but it doesn't as far as
> I can tell.
>
> Ideas?
>
> Thanks,
> Richard
>
>

Here is a script that runs as a user job to convert the files to mkv
format without transcoding, which works better with kodi and maybe with
other players. It does not change the file name, that was not necessary
for kodi to recognize that it is an mkv file.

https://github.com/bennettpeter/mythscripts/blob/master/install/opt/mythtv/bin/userjob_mkv.sh
Re: Update recording file name from command line? [ In reply to ]
On Mon, Dec 17, 2018 at 3:53 PM Peter Bennett <pb.mythtv@gmail.com> wrote:

>
>
> On 12/17/18 11:49 AM, Richard Shaw wrote:
>
> I still use a combined FE/BE in the living room but everywhere else I use
> either a Roku, Roku TV, and stream via Plex.
>
> Some channels work find but others have issues with audio sync. It seems
> like the video freezes right at the beginning but the audio does not so it
> stays out of sync.
>
> I've played around, especially on Plex and forcing it to transcode on the
> fly usually works but reduced video quality and the audio is changed from
> multi-channel to stereo so it's not an ideal solution.
>
> I noticed that recordings I've saved to videos via Avidemux to MKV
> container (video and audio are copied) don't have this problem so I was
> thinking of using mkvmerge in a transcode user job to move all my
> recordings from TS to MKV container formats.
>
> I plan to write a bash script around this but how do I go about updating
> the name of the recording in the database? Mythutil seems an obvious
> candidate to have this functionality but it doesn't as far as I can tell.
>
> Ideas?
>
> Thanks,
> Richard
>
>
>
> Here is a script that runs as a user job to convert the files to mkv
> format without transcoding, which works better with kodi and maybe with
> other players. It does not change the file name, that was not necessary for
> kodi to recognize that it is an mkv file.
>
>
> https://github.com/bennettpeter/mythscripts/blob/master/install/opt/mythtv/bin/userjob_mkv.sh
>

Hmm... I'll have to see if MythTV or Plex care about the file extension but
seems a dirty hack :)

It would really be nice if mythtranscode could do lossless H264 but I'll
have to ask Santa about that!

Thanks,
Richard
Re: Update recording file name from command line? [ In reply to ]
On 18/12/2018 00:09, Richard Shaw wrote:
> On Mon, Dec 17, 2018 at 3:53 PM Peter Bennett <pb.mythtv@gmail.com
> <mailto:pb.mythtv@gmail.com>> wrote:
>
>
>
> On 12/17/18 11:49 AM, Richard Shaw wrote:
>> I still use a combined FE/BE in the living room but everywhere
>> else I use either a Roku, Roku TV, and stream via Plex.
>>
>> Some channels work find but others have issues with audio sync. It
>> seems like the video freezes right at the beginning but the audio
>> does not so it stays out of sync.
>>
>> I've played around, especially on Plex and forcing it to transcode
>> on the fly usually works but reduced video quality and the audio
>> is changed from multi-channel to stereo so it's not an ideal solution.
>>
>> I noticed that recordings I've saved to videos via Avidemux to MKV
>> container (video and audio are copied) don't have this problem so
>> I was thinking of using mkvmerge in a transcode user job to move
>> all my recordings from TS to MKV container formats.
>>
>> I plan to write a bash script around this but how do I go about
>> updating the name of the recording in the database? Mythutil seems
>> an obvious candidate to have this functionality but it doesn't as
>> far as I can tell.
>>
>> Ideas?
>>
>> Thanks,
>> Richard
>>
>>
>
> Here is a script that runs as a user job to convert the files to mkv
> format without transcoding, which works better with kodi and maybe
> with other players. It does not change the file name, that was not
> necessary for kodi to recognize that it is an mkv file.
>
> https://github.com/bennettpeter/mythscripts/blob/master/install/opt/mythtv/bin/userjob_mkv.sh
>
>
> Hmm... I'll have to see if MythTV or Plex care about the file extension
> but seems a dirty hack :)
>
> It would really be nice if mythtranscode could do lossless H264 but I'll
> have to ask Santa about that!
>
> Thanks,
> Richard

I misunderstood your wish to rename your recording. I use this in
mythDVBcut to rename after conversion from .ts to .mpg

{{{

# tell mythDB about new filename and set the 'transcoded' flag
echo "update recorded set basename='${OUTFILE}', transcoded = 1
where recordedid = '$recordedid' ; " |
mysql -N -u${DBUserName} -p${DBPassword} -h${DBLocalHostName} ${DBName}


# Update the container type, needed for uPnP playback. Empty will
work too, if the transcoded flag is set.
# This is a HACK pending 0.28 release, when mythutil should do it.
See Ticket #12388

echo "update recordedfile set basename = '${OUTFILE}', container =
'MPEG2-PS' where recordedid = '$recordedid' ;" |
mysql -N -u${DBUserName} -p${DBPassword} -h${DBLocalHostName} ${DBName}

}}}
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Update recording file name from command line? [ In reply to ]
Tue, Dec 18, 2018 at 3:19 AM John Pilkington <johnpilk222@gmail.com> wrote:

> On 18/12/2018 00:09, Richard Shaw wrote:
>
> I misunderstood your wish to rename your recording. I use this in
> mythDVBcut to rename after conversion from .ts to .mpg
>
> {{{
>
> # tell mythDB about new filename and set the 'transcoded' flag
> echo "update recorded set basename='${OUTFILE}', transcoded = 1
> where recordedid = '$recordedid' ; " |
> mysql -N -u${DBUserName} -p${DBPassword} -h${DBLocalHostName} ${DBName}
>
>
> # Update the container type, needed for uPnP playback. Empty will
> work too, if the transcoded flag is set.
> # This is a HACK pending 0.28 release, when mythutil should do it.
> See Ticket #12388
>
> echo "update recordedfile set basename = '${OUTFILE}', container =
> 'MPEG2-PS' where recordedid = '$recordedid' ;" |
> mysql -N -u${DBUserName} -p${DBPassword} -h${DBLocalHostName} ${DBName}
>
> }}}


I would rather not do direct DB manipulation but this looks pretty
straightforward...

Thanks,
Richard
Re: Update recording file name from command line? [ In reply to ]
On 2018-12-18 23:16, Richard Shaw wrote:
> Tue, Dec 18, 2018 at 3:19 AM John Pilkington <johnpilk222@gmail.com> wrote:
>
>> On 18/12/2018 00:09, Richard Shaw wrote:
>>
>> I misunderstood your wish to rename your recording. I use this in
>> mythDVBcut to rename after conversion from .ts to .mpg
>>
>> {{{
>>
>> # tell mythDB about new filename and set the 'transcoded' flag
>> echo "update recorded set basename='${OUTFILE}', transcoded = 1
>> where recordedid = '$recordedid' ; " |
>> mysql -N -u${DBUserName} -p${DBPassword} -h${DBLocalHostName} ${DBName}
>>
>>
>> # Update the container type, needed for uPnP playback. Empty will
>> work too, if the transcoded flag is set.
>> # This is a HACK pending 0.28 release, when mythutil should do it.
>> See Ticket #12388
>>
>> echo "update recordedfile set basename = '${OUTFILE}', container =
>> 'MPEG2-PS' where recordedid = '$recordedid' ;" |
>> mysql -N -u${DBUserName} -p${DBPassword} -h${DBLocalHostName} ${DBName}
>>
>> }}}
>
>
> I would rather not do direct DB manipulation but this looks pretty
> straightforward...
>
> Thanks,
> Richard
>
>

i'm not exactly sure what your trying to do but regarding renaming recordings,
why not leave them as is and just use mythlink.pl instead?

sure it can't easily be used as is since i want different filename and folder
layout for movies and tv series.
so i made a small script that takes care of this for me by running a sql query
that categorizes the recordings into a few different groups by looking at
recording metadata and then for each of the categories it runs mythlink.pl with
different options.

this is what i use to make my recordings more easily available under kodi.
plus another script i made so i can let tvheadend handle the tv card(s) instead
of mythbackend directly.
this gives me option to also use kodi tv watching functions from same card(s)
and fixes a few longstanding really annoying issues with mythtv recording code.





_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Update recording file name from command line? [ In reply to ]
On Wed, Dec 19, 2018 at 5:40 AM Torbjorn Jansson <
torbjorn.jansson@mbox200.swipnet.se> wrote:

>
> i'm not exactly sure what your trying to do but regarding renaming
> recordings,
> why not leave them as is and just use mythlink.pl instead?
>

I already wrote a custom systemd service and timer to run mythlink in order
to get Plex friendly link names, that's not the problem.

The problem is Plex / Roku TVs are having issues with audio sync on SOME
channels and the current work around I have is to force Plex to transcode
at a lower bitrate where we lose video quality visibly and lose
surround sound, or I have noticed that when I use avidemux and simply
change the container from mpeg-ts to MKV and just copy the streams it seems
to fix it as well.

Since just changing container formats is easy I would like to setup a user
job to do this for all recordings and the purist in me would like use the
correct extension, .mkv, instead of leaving the file as a .ts and hoping
that Plex doesn't care about the extension.

mythtranscode supporting a lossless transcode for h264 like it does for
MPEG2 would be ideal but it doesn't appear to have made it to the top of
anyone's priority list even though most US cable broadcasts are in H264 now
(can't speak for outside US).

So I'm trying to figure out a reliable workaround.

Maybe adding the ability to rename recorded file names to mythutil wouldn't
be too hard to implement.

Thanks,
Richard
Re: Update recording file name from command line? [ In reply to ]
On 12/19/2018 09:23 AM, Richard Shaw wrote:
>
> Maybe adding the ability to rename recorded file names to mythutil
> wouldn't be too hard to implement.
>

We had the ability to do so in the past. The problem with it is that
some characters cannot be used in some locale settings and/or with some
file systems and some file systems have different
requirements/limitations for file name length and ... Therefore, the
user changes a file name and it seems to work now, then later something
on the system changes (locale settings, file system, ...) and then the
file gets a broken name and "MythTV is broken". Or the user changes the
file name in the shell/script/... that's running in one locale and "it
works" but has MythTV running in another locale and it can't find the
file so "MythTV is broken."

We decided to support only the built-in file name structure for
recordings since it uses only characters that are supported in all
locales and on all (known, reasonable-for-use-with-MythTV) file
systems. Ideally, rather than trying to encode information about the
recording into a file name/extension (a la Win 3.x/DOS), we would
support writing of the information into in-file video metadata.

Mike
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org