Mailing List Archive

Transcode script that keeps show in Recordings
I'm messing around with a test server right now as I don't current;y have
access to my old MythTV box. I thought I had put a copy of the scripts I
used in Google Drive, but apparently I didn't.

The user job script I had would run mythtranscode, honour the cutlet, if
anny rebuild the seektable and run with the --mpeg2 option, so even if you
hadn't created a cutlist, you could save about 20% of the initial .ts file.

The one thing it did, was move the tmp file to the current recording name
and move the original file to a .old. Having the edited file accessible
through recording was helpful if you suddenly noticed you missed a
commercial/PBS pledge break, as you could easily re-edit the file.

Anyone know the name of that script or remember authoring it?

Thanks.
Re: Transcode script that keeps show in Recordings [ In reply to ]
On 04/06/2023 17:44, Ian Evans wrote:
> I'm messing around with a test server right now as I don't current;y
> have access to my old MythTV box. I thought I had put a copy of the
> scripts I used in Google Drive, but apparently I didn't.
>
> The user job script I had would run mythtranscode, honour the cutlet, if
> anny rebuild the seektable and run with the --mpeg2 option, so even if
> you hadn't created a cutlist, you could save about 20% of the initial
> .ts file.
>
> The one thing it did, was move the tmp file to the current recording
> name and move the original file to a .old. Having the edited file
> accessible through recording was helpful if you suddenly noticed you
> missed a commercial/PBS pledge break, as you could easily re-edit the file.
>
> Anyone know the name of that script or remember authoring it?
>
> Thanks.
>

What you describe sounds to me like mythtranscode --mpeg2 'as is' and
I had thought that that is working now in reasonably current versions,
if you are still getting mpeg2 content. I'm afraid I haven't used it
recently.

I'm still using a script based on ProjectX for most of my cutting, but
PX has been out of development for years and has problems with newer
mpeg2 encoders. I do have scripts to cut these and h264 as well, but
the cutting is often less perfect and the process doesn't fit easily
into the mythtranscode mould.


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 4, 2023, at 12:44 PM, Ian Evans <dheianevans@gmail.com> wrote:
>
> I'm messing around with a test server right now as I don't current;y have access to my old MythTV box. I thought I had put a copy of the scripts I used in Google Drive, but apparently I didn't.
>
> The user job script I had would run mythtranscode, honour the cutlet, if anny rebuild the seektable and run with the --mpeg2 option, so even if you hadn't created a cutlist, you could save about 20% of the initial .ts file.
>
> The one thing it did, was move the tmp file to the current recording name and move the original file to a .old. Having the edited file accessible through recording was helpful if you suddenly noticed you missed a commercial/PBS pledge break, as you could easily re-edit the file.
>
> Anyone know the name of that script or remember authoring it?

I use this shell script to cut using the recorded markup table.

It uses ffmpeg to copy the fragments from the original as defined by the recorded markup table, and concatenates them using the ffmpeg copy function. It does not remove the original, but renames it for safety sake.

https://pastebin.com/uuBHpauQ?

I defined it as one of the jobs in mythtv as follows:

It uses the db connection information in the /etc/mythtv/config.xml to make connections.

/usr/local/bin/ffcut.sh %DIR% %CHANID% %STARTTIMEUTC% >> /tmp/ffcut.log

Regards
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Sun, Jun 4, 2023, 1:52 p.m. John Pilkington <johnpilk222@gmail.com>
wrote:

> On 04/06/2023 17:44, Ian Evans wrote:
> > I'm messing around with a test server right now as I don't current;y
> > have access to my old MythTV box. I thought I had put a copy of the
> > scripts I used in Google Drive, but apparently I didn't.
> >
> > The user job script I had would run mythtranscode, honour the cutlet, if
> > anny rebuild the seektable and run with the --mpeg2 option, so even if
> > you hadn't created a cutlist, you could save about 20% of the initial
> > .ts file.
> >
> > The one thing it did, was move the tmp file to the current recording
> > name and move the original file to a .old. Having the edited file
> > accessible through recording was helpful if you suddenly noticed you
> > missed a commercial/PBS pledge break, as you could easily re-edit the
> file.
> >
> > Anyone know the name of that script or remember authoring it?
> >
> > Thanks.
> >
>
> What you describe sounds to me like mythtranscode --mpeg2 'as is' and
> I had thought that that is working now in reasonably current versions,
> if you are still getting mpeg2 content. I'm afraid I haven't used it
> recently.
>
> If I remember correctly, mythtranscode would create a tmp file next to the
original. If I recall, the script I would using would rename the original
file filename.old and rename the tmp to the original filename. My google
and list search has turned up empty. Maybe I need coffee.

>
>
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Mon, Jun 5, 2023 at 10:07?AM Ian Evans <dheianevans@gmail.com> wrote:

>
>
> On Sun, Jun 4, 2023, 1:52 p.m. John Pilkington <johnpilk222@gmail.com>
> wrote:
>
>> On 04/06/2023 17:44, Ian Evans wrote:
>> > I'm messing around with a test server right now as I don't current;y
>> > have access to my old MythTV box. I thought I had put a copy of the
>> > scripts I used in Google Drive, but apparently I didn't.
>> >
>> > The user job script I had would run mythtranscode, honour the cutlet,
>> if
>> > anny rebuild the seektable and run with the --mpeg2 option, so even if
>> > you hadn't created a cutlist, you could save about 20% of the initial
>> > .ts file.
>> >
>> > The one thing it did, was move the tmp file to the current recording
>> > name and move the original file to a .old. Having the edited file
>> > accessible through recording was helpful if you suddenly noticed you
>> > missed a commercial/PBS pledge break, as you could easily re-edit the
>> file.
>> >
>> > Anyone know the name of that script or remember authoring it?
>> >
>> > Thanks.
>> >
>>
>> What you describe sounds to me like mythtranscode --mpeg2 'as is' and
>> I had thought that that is working now in reasonably current versions,
>> if you are still getting mpeg2 content. I'm afraid I haven't used it
>> recently.
>>
>> If I remember correctly, mythtranscode would create a tmp file next to
> the original. If I recall, the script I would using would rename the
> original file filename.old and rename the tmp to the original filename. My
> google and list search has turned up empty. Maybe I need coffee.
>


The script I use is one from the mythtv forum call sendTVtoNAS which uses
mythutils and Handbrake to take the video clean out the commercials per the
cur list and transcode the .TS to a .m4v h.264 and put on a NAS or some
other folder. It leaves your original alone.

https://forum.mythtv.org/viewtopic.php?f=2&t=1261

Jim A
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Mon, Jun 5, 2023, 11:03 a.m. James Abernathy <jfabernathy@gmail.com>
wrote:

>
>
> On Mon, Jun 5, 2023 at 10:07?AM Ian Evans <dheianevans@gmail.com> wrote:
>
>>
>>
>> On Sun, Jun 4, 2023, 1:52 p.m. John Pilkington <johnpilk222@gmail.com>
>> wrote:
>>
>>> On 04/06/2023 17:44, Ian Evans wrote:
>>> > I'm messing around with a test server right now as I don't current;y
>>> > have access to my old MythTV box. I thought I had put a copy of the
>>> > scripts I used in Google Drive, but apparently I didn't.
>>> >
>>> > The user job script I had would run mythtranscode, honour the cutlet,
>>> if
>>> > anny rebuild the seektable and run with the --mpeg2 option, so even if
>>> > you hadn't created a cutlist, you could save about 20% of the initial
>>> > .ts file.
>>> >
>>> > The one thing it did, was move the tmp file to the current recording
>>> > name and move the original file to a .old. Having the edited file
>>> > accessible through recording was helpful if you suddenly noticed you
>>> > missed a commercial/PBS pledge break, as you could easily re-edit the
>>> file.
>>> >
>>> > Anyone know the name of that script or remember authoring it?
>>> >
>>> > Thanks.
>>> >
>>>
>>> What you describe sounds to me like mythtranscode --mpeg2 'as is' and
>>> I had thought that that is working now in reasonably current versions,
>>> if you are still getting mpeg2 content. I'm afraid I haven't used it
>>> recently.
>>>
>>> If I remember correctly, mythtranscode would create a tmp file next to
>> the original. If I recall, the script I would using would rename the
>> original file filename.old and rename the tmp to the original filename. My
>> google and list search has turned up empty. Maybe I need coffee.
>>
>
>
> The script I use is one from the mythtv forum call sendTVtoNAS which uses
> mythutils and Handbrake to take the video clean out the commercials per the
> cur list and transcode the .TS to a .m4v h.264 and put on a NAS or some
> other folder. It leaves your original alone.
>
> https://forum.mythtv.org/viewtopic.php?f=2&t=1261
>
> Jim A
>
>

Yes, I have that script too. But the one I had on my old backend left it in
records and updated the database. That way you could easily check from the
frontend if the edit was fine and then do a re-edit if necessary. Then you
could send it off to the Videos with another job.

I'll keep digging. Thanks.

>
>
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 5, 2023, at 11:10 AM, Ian Evans <dheianevans@gmail.com> wrote:
>>
>>
>
>
> Yes, I have that script too. But the one I had on my old backend left it in records and updated the database. That way you could easily check from the frontend if the edit was fine and then do a re-edit if necessary. Then you could send it off to the Videos with another job.
>

This script I posted would do as you indicate, keeping the video as a ts file, just removing the parts defined in the cultist.

For reference it is ffcut.sh and does not remove the original file.

It is still live for 2 hours on pastebin. As below:

https://pastebin.com/uuBHpauQ?


> I'll keep digging. Thanks.
>>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org <mailto:mythtv-users@mythtv.org>
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org <https://forum.mythtv.org/>
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Mon, Jun 5, 2023 at 11:34?AM Jay Harbeston <jharbestonus@gmail.com>
wrote:

>
>
> On Jun 5, 2023, at 11:10 AM, Ian Evans <dheianevans@gmail.com> wrote:
>
>>
>>
>>
>
> Yes, I have that script too. But the one I had on my old backend left it
> in records and updated the database. That way you could easily check from
> the frontend if the edit was fine and then do a re-edit if necessary. Then
> you could send it off to the Videos with another job.
>
>
> This script I posted would do as you indicate, keeping the video as a ts
> file, just removing the parts defined in the cultist.
>
> For reference it is ffcut.sh and does not remove the original file.
>
> It is still live for 2 hours on pastebin. As below:
>
> ffcut.sh <https://pastebin.com/uuBHpauQ>
> pastebin.com <https://pastebin.com/uuBHpauQ>
> [image: favicon.ico] <https://pastebin.com/uuBHpauQ>
> <https://pastebin.com/uuBHpauQ> <https://pastebin.com/uuBHpauQ>
>


Jay, I tried ffcut.sh on my v34 master version of mythtv on a test system
and it keeps failing. I have not had a chance to find out why

Jim A
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 5, 2023, at 11:54 AM, James Abernathy <jfabernathy@gmail.com> wrote:
>
>
>
>
> Jay, I tried ffcut.sh on my v34 master version of mythtv on a test system and it keeps failing. I have not had a chance to find out why

Probably because the mysql cmd is not authenticating. I use mysql mysql and not MariaDB, and mysql no longer allows the login/paswd to be passed on the cmd line. I had to modify the codlin to use a .mylogin.cnf file to keep from having to use the cmd line -u and -p options.

You can modify the mysql cmd to put those back in if you are using MariaDB.

Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Mon, Jun 5, 2023 at 1:11?PM Jay Harbeston <jharbestonus@gmail.com> wrote:

>
>
> On Jun 5, 2023, at 11:54 AM, James Abernathy <jfabernathy@gmail.com>
> wrote:
>
>
>
>
> Jay, I tried ffcut.sh on my v34 master version of mythtv on a test system
> and it keeps failing. I have not had a chance to find out why
>
>
> Probably because the mysql cmd is not authenticating. I use mysql mysql
> and not MariaDB, and mysql no longer allows the login/paswd to be passed on
> the cmd line. I had to modify the codlin to use a .mylogin.cnf file to keep
> from having to use the cmd line -u and -p options.
>
> You can modify the mysql cmd to put those back in if you are using MariaDB.
>
> Jay
>
> Yes I'm using mariadb. I'm going to need some help fixing this.
Obviously I need to fix the statements like:
mysql --login-path=local -N "${dbname}"

Normal to work on the database I do:

sudo mysql -u root -p [return]
then I'm asked for my sudo password. Sometimes I get another password
request and I enter the same sudo password.

Not sure how I replace the --login-path=local with mysql -u root -p.

I tried just putting in mysql -u root -p but that didn't work. When I
tried putting in
mysql -u root -p 1234
assuming 1234 was my sudo password. They failed filling up the ffcut.log
with mysql --help stuff,

JIm A
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 5, 2023, at 3:08 PM, James Abernathy <jfabernathy@gmail.com> wrote:
>
>
> sudo mysql -u root -p [return]
> then I'm asked for my sudo password. Sometimes I get another password request and I enter the same sudo password.
>
> Not sure how I replace the --login-path=local with mysql -u root -p.
>
> I tried just putting in mysql -u root -p but that didn't work. When I tried putting in
> mysql -u root -p 1234
> assuming 1234 was my sudo password. They failed filling up the ffcut.log with mysql --help stuff,

If the mythtv user is set up to login using the standard auth, you may not need the -u and -p arguments as it relies on the login already authenticating the mythtv user. You would want to just remove that info and run the ffcut as the mythtv user.

Jay
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 5, 2023, at 3:08 PM, James Abernathy <jfabernathy@gmail.com> wrote:
>
>
> sudo mysql -u root -p [return]
> then I'm asked for my sudo password. Sometimes I get another password request and I enter the same sudo password.
>
> Not sure how I replace the --login-path=local with mysql -u root -p.
>
> I tried just putting in mysql -u root -p but that didn't work. When I tried putting in
> mysql -u root -p 1234
> assuming 1234 was my sudo password. They failed filling up the ffcut.log with mysql --help stuff,

If the mythtv user is set up to login using the standard auth, you may not need the -u and -p arguments as it relies on the login already authenticating the mythtv user. You would want to just remove that info and run the ffcut as the mythtv user.

Jay
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Mon, Jun 5, 2023 at 3:58?PM Jay Harbeston <jharbestonus@gmail.com> wrote:

>
>
> > On Jun 5, 2023, at 3:08 PM, James Abernathy <jfabernathy@gmail.com>
> wrote:
> >
> >
> > sudo mysql -u root -p [return]
> > then I'm asked for my sudo password. Sometimes I get another password
> request and I enter the same sudo password.
> >
> > Not sure how I replace the --login-path=local with mysql -u root -p.
> >
> > I tried just putting in mysql -u root -p but that didn't work. When I
> tried putting in
> > mysql -u root -p 1234
> > assuming 1234 was my sudo password. They failed filling up the ffcut.log
> with mysql --help stuff,
>
> If the mythtv user is set up to login using the standard auth, you may not
> need the -u and -p arguments as it relies on the login already
> authenticating the mythtv user. You would want to just remove that info
> and run the ffcut as the mythtv user.
>
> Jay
>
>
I removed all the -u root -p stuff and still fails. in the fftotal.log
the last line is
/tmp/myth6544/filelist.txt: No such file or directory

The ffcut.log shows

Mon Jun 5 04:14:34 PM EDT 2023
mythdir=/srv/mythtv/recordings chanid=10501 starttimeutc=20230604223000
query = select basename from recorded where chanid = 10501 and starttime =
'20230604223000';
Basename =
process the file for infile: /srv/mythtv/recordings/: 10501 20230604223000

query1 = select data , type from recordedmarkup where chanid = '10501'
and starttime = '202306
04223000' and ( type = 34 or type = 32 ) into outfile
'/tmp/myth6544/queryres' FIELDS TERM
INATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
/tmp/myth6544/queryres contents for framerate/framecount:
------------------------------
------------------------------
framerate = /srv/mythtv/recordings
maxframes = 10501
select mark , type from recordedmarkup where chanid = '10501' and starttime
= '20230604223000' and (
type = 0 or type = 1 ) order by mark asc into outfile
'/tmp/myth6544/queryres' FIELDS TERMINATED BY
'\t' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
/tmp/myth6544/queryres contents for cutlist:
------------------------------
------------------------------
There are /srv/mythtv/recordings records for infile
counter=3
counter=3
mark = /srv/mythtv/recordings ; type = 10501
counter=1
mark = 20230604223000 ; type =
ffmpeg -f concat -safe 0 -i /tmp/myth6544/filelist.txt -c copy
/tmp/myth6544/tmpfile.ts
Conversion did not occur correctly
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 5, 2023, at 4:23 PM, James Abernathy <jfabernathy@gmail.com> wrote:
>
>
>
> On Mon, Jun 5, 2023 at 3:58?PM Jay Harbeston <jharbestonus@gmail.com <mailto:jharbestonus@gmail.com>> wrote:
>>
>>
>> > On Jun 5, 2023, at 3:08 PM, James Abernathy <jfabernathy@gmail.com <mailto:jfabernathy@gmail.com>> wrote:
>> >
>> >
>> > sudo mysql -u root -p [return]
>> > then I'm asked for my sudo password. Sometimes I get another password request and I enter the same sudo password.
>> >
>> > Not sure how I replace the --login-path=local with mysql -u root -p.
>> >
>> > I tried just putting in mysql -u root -p but that didn't work. When I tried putting in
>> > mysql -u root -p 1234
>> > assuming 1234 was my sudo password. They failed filling up the ffcut.log with mysql --help stuff,
>>
>> If the mythtv user is set up to login using the standard auth, you may not need the -u and -p arguments as it relies on the login already authenticating the mythtv user. You would want to just remove that info and run the ffcut as the mythtv user.
>>
>> Jay
>>
>
> I removed all the -u root -p stuff and still fails. in the fftotal.log the last line is
> /tmp/myth6544/filelist.txt: No such file or directory
>
> The ffcut.log shows
>
> Mon Jun 5 04:14:34 PM EDT 2023
> mythdir=/srv/mythtv/recordings chanid=10501 starttimeutc=20230604223000
> query = select basename from recorded where chanid = 10501 and starttime = '20230604223000';
> Basename =
> process the file for infile: /srv/mythtv/recordings/: 10501 20230604223000
>
> query1 = select data , type from recordedmarkup where chanid = '10501' and starttime = '202306
> 04223000' and ( type = 34 or type = 32 ) into outfile '/tmp/myth6544/queryres' FIELDS TERM
> INATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
> /tmp/myth6544/queryres contents for framerate/framecount:
> ------------------------------
> ------------------------------
> framerate = /srv/mythtv/recordings
> maxframes = 10501
> select mark , type from recordedmarkup where chanid = '10501' and starttime = '20230604223000' and (
> type = 0 or type = 1 ) order by mark asc into outfile '/tmp/myth6544/queryres' FIELDS TERMINATED BY
> '\t' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
> /tmp/myth6544/queryres contents for cutlist:
> ------------------------------
> ------------------------------
> There are /srv/mythtv/recordings records for infile
> counter=3
> counter=3
> mark = /srv/mythtv/recordings ; type = 10501
> counter=1
> mark = 20230604223000 ; type =

There’s something wrong in the line above, the type should not be blank. Look at the record involved using phpmyadmin.. there may be a problem with that cut.


> ffmpeg -f concat -safe 0 -i /tmp/myth6544/filelist.txt -c copy /tmp/myth6544/tmpfile.ts
> Conversion did not occur correctly
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Mon, Jun 5, 2023 at 6:38?PM Jay Harbeston <jharbestonus@gmail.com> wrote:

>
>
> On Jun 5, 2023, at 4:23 PM, James Abernathy <jfabernathy@gmail.com> wrote:
>
>
>
> On Mon, Jun 5, 2023 at 3:58?PM Jay Harbeston <jharbestonus@gmail.com>
> wrote:
>
>>
>>
>> > On Jun 5, 2023, at 3:08 PM, James Abernathy <jfabernathy@gmail.com>
>> wrote:
>> >
>> >
>> > sudo mysql -u root -p [return]
>> > then I'm asked for my sudo password. Sometimes I get another password
>> request and I enter the same sudo password.
>> >
>> > Not sure how I replace the --login-path=local with mysql -u root -p.
>> >
>> > I tried just putting in mysql -u root -p but that didn't work. When I
>> tried putting in
>> > mysql -u root -p 1234
>> > assuming 1234 was my sudo password. They failed filling up the
>> ffcut.log with mysql --help stuff,
>>
>> If the mythtv user is set up to login using the standard auth, you may
>> not need the -u and -p arguments as it relies on the login already
>> authenticating the mythtv user. You would want to just remove that info
>> and run the ffcut as the mythtv user.
>>
>> Jay
>>
>>
> I removed all the -u root -p stuff and still fails. in the fftotal.log
> the last line is
> /tmp/myth6544/filelist.txt: No such file or directory
>
> The ffcut.log shows
>
> Mon Jun 5 04:14:34 PM EDT 2023
> mythdir=/srv/mythtv/recordings chanid=10501 starttimeutc=20230604223000
> query = select basename from recorded where chanid = 10501 and starttime =
> '20230604223000';
> Basename =
> process the file for infile: /srv/mythtv/recordings/: 10501
> 20230604223000
>
> query1 = select data , type from recordedmarkup where chanid = '10501'
> and starttime = '202306
> 04223000' and ( type = 34 or type = 32 ) into outfile
> '/tmp/myth6544/queryres' FIELDS TERM
> INATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY
> '\n';
> /tmp/myth6544/queryres contents for framerate/framecount:
> ------------------------------
> ------------------------------
> framerate = /srv/mythtv/recordings
> maxframes = 10501
> select mark , type from recordedmarkup where chanid = '10501' and
> starttime = '20230604223000' and (
> type = 0 or type = 1 ) order by mark asc into outfile
> '/tmp/myth6544/queryres' FIELDS TERMINATED BY
> '\t' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
> /tmp/myth6544/queryres contents for cutlist:
> ------------------------------
> ------------------------------
> There are /srv/mythtv/recordings records for infile
> counter=3
> counter=3
> mark = /srv/mythtv/recordings ; type = 10501
> counter=1
> mark = 20230604223000 ; type =
>
>
> There’s something wrong in the line above, the type should not be blank.
> Look at the record involved using phpmyadmin.. there may be a problem with
> that cut.
>
>
> ffmpeg -f concat -safe 0 -i /tmp/myth6544/filelist.txt -c copy
> /tmp/myth6544/tmpfile.ts
> Conversion did not occur correctly
>
>
I have 3 recordings on this test system and I used mythfrontend to correct
the cutlist after commercial flagging was completed. I 2 with the same
basic errors you saw with the type = [blank] on the last mark statement.
Not sure on what to look for in the database, but I have phpmyadmin up and
running on mythconverg.

I did try to do a lossless copy using mythtranscode with --honorcutlist and
it fails with a fair number of bad file descriptors. Not sure what that is
all about. The recordings look perfect in mythfronted when you watch
them. No visual errors. All this is the latest Master that I updated to
today.

Jim A
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 5, 2023, at 9:35 PM, James Abernathy <jfabernathy@gmail.com> wrote:
>
>
>
> On Mon, Jun 5, 2023 at 6:38?PM Jay Harbeston <jharbestonus@gmail.com <mailto:jharbestonus@gmail.com>> wrote:
>>
>>
>>> On Jun 5, 2023, at 4:23 PM, James Abernathy <jfabernathy@gmail.com <mailto:jfabernathy@gmail.com>> wrote:
>>>
>>>
>>>
>>> On Mon, Jun 5, 2023 at 3:58?PM Jay Harbeston <jharbestonus@gmail.com <mailto:jharbestonus@gmail.com>> wrote:
>>>>
>>>>
>>>> > On Jun 5, 2023, at 3:08 PM, James Abernathy <jfabernathy@gmail.com <mailto:jfabernathy@gmail.com>> wrote:
>>>> >
>>>> >
>>>> > sudo mysql -u root -p [return]
>>>> > then I'm asked for my sudo password. Sometimes I get another password request and I enter the same sudo password.
>>>> >
>>>> > Not sure how I replace the --login-path=local with mysql -u root -p.
>>>> >
>>>> > I tried just putting in mysql -u root -p but that didn't work. When I tried putting in
>>>> > mysql -u root -p 1234
>>>> > assuming 1234 was my sudo password. They failed filling up the ffcut.log with mysql --help stuff,
>>>>
>>>> If the mythtv user is set up to login using the standard auth, you may not need the -u and -p arguments as it relies on the login already authenticating the mythtv user. You would want to just remove that info and run the ffcut as the mythtv user.
>>>>
>>>> Jay
>>>>
>>>
>>> I removed all the -u root -p stuff and still fails. in the fftotal.log the last line is
>>> /tmp/myth6544/filelist.txt: No such file or directory
>>>
>>> The ffcut.log shows
>>>
>>> Mon Jun 5 04:14:34 PM EDT 2023
>>> mythdir=/srv/mythtv/recordings chanid=10501 starttimeutc=20230604223000
>>> query = select basename from recorded where chanid = 10501 and starttime = '20230604223000';
>>> Basename =
>>> process the file for infile: /srv/mythtv/recordings/: 10501 20230604223000
>>>
>>> query1 = select data , type from recordedmarkup where chanid = '10501' and starttime = '202306
>>> 04223000' and ( type = 34 or type = 32 ) into outfile '/tmp/myth6544/queryres' FIELDS TERM
>>> INATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
>>> /tmp/myth6544/queryres contents for framerate/framecount:
>>> ------------------------------
>>> ------------------------------
>>> framerate = /srv/mythtv/recordings
>>> maxframes = 10501
>>> select mark , type from recordedmarkup where chanid = '10501' and starttime = '20230604223000' and (
>>> type = 0 or type = 1 ) order by mark asc into outfile '/tmp/myth6544/queryres' FIELDS TERMINATED BY
>>> '\t' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
>>> /tmp/myth6544/queryres contents for cutlist:
>>> ------------------------------
>>> ------------------------------
>>> There are /srv/mythtv/recordings records for infile
>>> counter=3
>>> counter=3
>>> mark = /srv/mythtv/recordings ; type = 10501
>>> counter=1
>>> mark = 20230604223000 ; type =
>>
>> There’s something wrong in the line above, the type should not be blank. Look at the record involved using phpmyadmin.. there may be a problem with that cut.
>>
>>
>>> ffmpeg -f concat -safe 0 -i /tmp/myth6544/filelist.txt -c copy /tmp/myth6544/tmpfile.ts
>>> Conversion did not occur correctly
>
> I have 3 recordings on this test system and I used mythfrontend to correct the cutlist after commercial flagging was completed. I 2 with the same basic errors you saw with the type = [blank] on the last mark statement. Not sure on what to look for in the database, but I have phpmyadmin up and running on mythconverg.
>
> I did try to do a lossless copy using mythtranscode with --honorcutlist and it fails with a fair number of bad file descriptors. Not sure what that is all about. The recordings look perfect in mythfronted when you watch them. No visual errors. All this is the latest Master that I updated to today.
>
> Jim A
>
> ____


I am looking at it now. Looks like mysql cmd line output has changed on me since I last used this shell script. Of note, make sure you also have ffmpeg installed as well as that is what is used to cut/copy the segments as well as ‘glue’ them back together.

Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Tue, Jun 6, 2023 at 8:27?AM Jay Harbeston <jharbestonus@gmail.com> wrote:

>
> I am looking at it now. Looks like mysql cmd line output has changed on
> me since I last used this shell script. Of note, make sure you also have
> ffmpeg installed as well as that is what is used to cut/copy the segments
> as well as ‘glue’ them back together.
>
> Jay
>
>
I'll keep playing with this. I find it interesting and I might learn
something interesting. I'll be interested in seeing what you find. I'm also
troubled by what I see as failing on mythtranscode on the same file.
Either there are problems with the file or v34 Master and transcode have
issues.

JIm A
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 6, 2023, at 8:40 AM, James Abernathy <jfabernathy@gmail.com> wrote:
>
>
>
> On Tue, Jun 6, 2023 at 8:27?AM Jay Harbeston <jharbestonus@gmail.com <mailto:jharbestonus@gmail.com>> wrote:
>>
>> I am looking at it now. Looks like mysql cmd line output has changed on me since I last used this shell script. Of note, make sure you also have ffmpeg installed as well as that is what is used to cut/copy the segments as well as ‘glue’ them back together.
>>
>> Jay
>>
>
> I'll keep playing with this. I find it interesting and I might learn something interesting. I'll be interested in seeing what you find. I'm also troubled by what I see as failing on mythtranscode on the same file. Either there are problems with the file or v34 Master and transcode have issues.

Do you have a queryres file in the /tmp/mythNNNNNNN directory? Mysql has tightened their permissions such that I have abandoned them in my other shell scripts that I have since converted to python. I think I am going to have to convert this shell to python as well. The shell version just became too cumbersome with regard to getting data to use out of the database .


Mariadb may not be so ‘tight’ with permissions as mysql is.

Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Tue, Jun 6, 2023, 8:46 AM Jay Harbeston <jharbestonus@gmail.com> wrote:

>
>
> On Jun 6, 2023, at 8:40 AM, James Abernathy <jfabernathy@gmail.com> wrote:
>
>
>
> On Tue, Jun 6, 2023 at 8:27?AM Jay Harbeston <jharbestonus@gmail.com>
> wrote:
>
>>
>> I am looking at it now. Looks like mysql cmd line output has changed on
>> me since I last used this shell script. Of note, make sure you also have
>> ffmpeg installed as well as that is what is used to cut/copy the segments
>> as well as ‘glue’ them back together.
>>
>> Jay
>>
>>
> I'll keep playing with this. I find it interesting and I might learn
> something interesting. I'll be interested in seeing what you find. I'm also
> troubled by what I see as failing on mythtranscode on the same file.
> Either there are problems with the file or v34 Master and transcode have
> issues.
>
>
> Do you have a queryres file in the /tmp/mythNNNNNNN directory? Mysql has
> tightened their permissions such that I have abandoned them in my other
> shell scripts that I have since converted to python. I think I am going to
> have to convert this shell to python as well. The shell version just became
> too cumbersome with regard to getting data to use out of the database .
>
>
> Mariadb may not be so ‘tight’ with permissions as mysql is.
>
> Jay
> _________________________
>

No gueryres file.

Jim A
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Mon, 5 Jun 2023 15:08:31 -0400, you wrote:


>I tried just putting in mysql -u root -p but that didn't work. When I
>tried putting in
>mysql -u root -p 1234
>assuming 1234 was my sudo password. They failed filling up the ffcut.log
>with mysql --help stuff,

The password must be directly after the -p option with no space in
between. A space is ok after the -u option.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Tue, Jun 6, 2023 at 9:59?AM Stephen Worthington <stephen_agent@jsw.gen.nz>
wrote:

> On Mon, 5 Jun 2023 15:08:31 -0400, you wrote:
>
>
> >I tried just putting in mysql -u root -p but that didn't work. When I
> >tried putting in
> >mysql -u root -p 1234
> >assuming 1234 was my sudo password. They failed filling up the ffcut.log
> >with mysql --help stuff,
>
> The password must be directly after the -p option with no space in
> between. A space is ok after the -u option.
>
>
Thanks, If in the ffcut.sh script I have the cmds use

mysql -uroot
or
mysql -uroot -p1234

The results are the same for mariadb. The database query stuff seems to be
working, it's something related to the filelist.txt getting created
correctly.

JIm A
Re: Transcode script that keeps show in Recordings [ In reply to ]
>
> The results are the same for mariadb. The database query stuff seems to be working, it's something related to the filelist.txt getting created correctly.
>


The underlying problem is that evidently MariaDB doesn’t allow an external file to be created the same as mysql. Since the queryres file is no longer created, nothing else happens.


I am converting to python so that the returned data from the query is in a data array and then parsing the data array instead of from a input file.

Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Tue, 6 Jun 2023 10:47:45 -0400, you wrote:

>
>>
>> The results are the same for mariadb. The database query stuff seems to be working, it's something related to the filelist.txt getting created correctly.
>>
>
>
>The underlying problem is that evidently MariaDB doesn?t allow an external file to be created the same as mysql. Since the queryres file is no longer created, nothing else happens.
>
>
>I am converting to python so that the returned data from the query is in a data array and then parsing the data array instead of from a input file.
>
> Jay


In MariaDB if you are exporting data to a file the secure_file_priv
variable (if set) limits the location you can save to. So check to
see if it is set:

SHOW VARIABLES LIKE "secure_file_priv";

Only if it is an empty string can you store the file anywhere you
like.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Tue, Jun 6, 2023 at 11:32?AM Stephen Worthington <
stephen_agent@jsw.gen.nz> wrote:

> On Tue, 6 Jun 2023 10:47:45 -0400, you wrote:
>
> >
> >>
> >> The results are the same for mariadb. The database query stuff seems
> to be working, it's something related to the filelist.txt getting created
> correctly.
> >>
> >
> >
> >The underlying problem is that evidently MariaDB doesn’t allow an
> external file to be created the same as mysql. Since the queryres file is
> no longer created, nothing else happens.
> >
> >
> >I am converting to python so that the returned data from the query is in
> a data array and then parsing the data array instead of from a input file.
> >
> > Jay
>
>
> In MariaDB if you are exporting data to a file the secure_file_priv
> variable (if set) limits the location you can save to. So check to
> see if it is set:
>
> SHOW VARIABLES LIKE "secure_file_priv";
>
> Only if it is an empty string can you store the file anywhere you
> like.
>
>
Interesting! I did:
mythtv@ubuntu-mythtv:~$ sudo mysql -uroot -p
[sudo] password for mythtv:
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 152
Server version: 10.11.2-MariaDB-1 Ubuntu 23.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.

MariaDB [(none)]> use mythconverg;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mythconverg]> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | |
+------------------+-------+
1 row in set (0.001 sec)

Looks empty to me.

Jim A
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 6, 2023, at 12:22 PM, James Abernathy <jfabernathy@gmail.com> wrote:
>
>
> Database changed
> MariaDB [mythconverg]> SHOW VARIABLES LIKE "secure_file_priv";
> +------------------+-------+
> | Variable_name | Value |
> +------------------+-------+
> | secure_file_priv | |
> +------------------+-------+
> 1 row in set (0.001 sec)
>
> Looks empty to me.


I was afraid of that. My attempts to find a solution in mysql failed to find a solution. So much security so little time! :-)

Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
-----Original message-----
From: Jay Harbeston <jharbestonus@gmail.com>
Sent: Tuesday 6th June 2023 17:32
To: Discussion about MythTV <mythtv-users@mythtv.org>
Subject: Re: [mythtv-users] Transcode script that keeps show in Recordings



On Jun 6, 2023, at 12:22 PM, James Abernathy <jfabernathy@gmail.com> wrote:


Database changed
MariaDB [mythconverg]> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| secure_file_priv |       |
+------------------+-------+
1 row in set (0.001 sec)

Looks empty to me.


I was afraid of that. My attempts to find a solution in mysql failed to find a solution. So much security so little time! :-)

Jay



This has worked for me in mysql, I presume it would also work for MariaDB:


grant file on *.* to 'mythtv'@'localhost';



The problem then was that the output file was owned by the mysql user, so I had to add the mysql group to the user that I was using to run ffcut.sh



Regards,

Dave.
Re: Transcode script that keeps show in Recordings [ In reply to ]
I have created a python version of ffcut.sh and am currently making sure I have most of the kinks out of it.

I’m thinking tomorrow I should be able to post the python version the same way as I did the shell version.

With the python version I did not have to create the text files as intermediary holding arrays for data that needed to be used.

It will require python version 3+.

When I created it originally, mythtranscode would not handle mp4 streams that we were getting from the HDHRs when silicon dust did the 4 or so month experiment of being a content provider from the cloud. The ffmpeg version ffcut.sh and soon the ffcut.py version will be able to handle both mp4 and mpeg 2 transport streams.

Jay
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On 8 Jun 2023, at 7:08 am, Jay Harbeston <jharbestonus@gmail.com> wrote:
>
>
>
> I have created a python version of ffcut.sh and am currently making sure I have most of the kinks out of it.
>
> I’m thinking tomorrow I should be able to post the python version the same way as I did the shell version.
>
> With the python version I did not have to create the text files as intermediary holding arrays for data that needed to be used.
>
> It will require python version 3+.
>
> jamesWhen I created it originally, mythtranscode would not handle mp4 streams that we were getting from the HDHRs when silicon dust did the 4 or so month experiment of being a content provider from the cloud. The ffmpeg version ffcut.sh and soon the ffcut.py version will be able to handle both mp4 and mpeg 2 transport streams.

Can you cut h264 recordings?

I have 2 trancode-lossless scripts, 1 for each

James
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 7, 2023, at 7:13 PM, James <jam@tigger.ws> wrote:
>
>
>
>> On 8 Jun 2023, at 7:08 am, Jay Harbeston <jharbestonus@gmail.com <mailto:jharbestonus@gmail.com>> wrote:
>>
>>
>>
>> I have created a python version of ffcut.sh and am currently making sure I have most of the kinks out of it.
>>
>> I’m thinking tomorrow I should be able to post the python version the same way as I did the shell version.
>>
>> With the python version I did not have to create the text files as intermediary holding arrays for data that needed to be used.
>>
>> It will require python version 3+.
>>
>> jamesWhen I created it originally, mythtranscode would not handle mp4 streams that we were getting from the HDHRs when silicon dust did the 4 or so month experiment of being a content provider from the cloud. The ffmpeg version ffcut.sh and soon the ffcut.py version will be able to handle both mp4 and mpeg 2 transport streams.
>
> Can you cut h264 recordings?
>
> I have 2 trancode-lossless scripts, 1 for each
>

I know it can cut mp4 ts streams…

If ffmpeg can cut h264 and there is a list of cuts in mythtv, it should be able to. I do know that mp4s created from handbrake can not create a seektaable, so cannot be flagged in mythtv.
Re: Transcode script that keeps show in Recordings [ In reply to ]
Hi Jay,



I had to make a few modifications to your ffcut.sh script to get it to work - modifying the mysql commands, slightly as they didn't work on my system as written, but I soon resolved that.



The other modifications I had to make were to the ffmpeg commands, since my h264 recordings with AC3 5.1 audio were transcoding without audio - I changed the commands as follows:



 cmdffmpeg="ffmpeg -i $infile -t $duration -ss $ss -map 0:v -c:v copy -map 0:1 -c:a ac3 -ar 48000 $outfile"



and



cmdffmpeg="ffmpeg -f concat -safe 0 -i $tmpdir/filelist.txt -map 0:v -c:v copy -map 0:1 -c:a ac3 -ar 48000 $outfile"



this resolved the audio problems, but I am unable to rebuild the seektable for the newly transcoded recordings





I imagine that the ffmpeg command needs some further modification, but I have no idea what that would be - maybe this will help you, though, with your python script?



Regards,

Dave 





-----Original message-----
From: Jay Harbeston <jharbestonus@gmail.com>
Sent: Thursday 8th June 2023 0:20
To: Discussion about MythTV <mythtv-users@mythtv.org>
Subject: Re: [mythtv-users] Transcode script that keeps show in Recordings



On Jun 7, 2023, at 7:13 PM, James <jam@tigger.ws> wrote:



On 8 Jun 2023, at 7:08 am, Jay Harbeston <jharbestonus@gmail.com <mailto:jharbestonus@gmail.com> > wrote:



I have created a python version of ffcut.sh and am currently making sure I have most of the kinks out of it. 

I’m thinking tomorrow I should be able to post the python version the same way as I did the shell version. 

With the python version I did not have to create the text files as intermediary holding arrays for data that needed to be used.

It will require python version 3+.

jamesWhen I created it originally, mythtranscode would not handle mp4 streams that we were getting from the HDHRs when silicon dust did the 4 or so month experiment of being a content provider from the cloud. The ffmpeg version ffcut.sh and soon the ffcut.py version will be able to handle both mp4 and mpeg 2 transport streams.

Can you cut h264 recordings?

I have 2 trancode-lossless scripts, 1 for each


I know it can cut mp4 ts streams… 

If  ffmpeg can cut h264 and there is a list of cuts in mythtv, it should be able to.  I do know that mp4s created from handbrake can not create a seektaable, so cannot be flagged in mythtv.
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Wed, Jun 7, 2023 at 7:21?PM Jay Harbeston <jharbestonus@gmail.com> wrote:

>
>
> On Jun 7, 2023, at 7:13 PM, James <jam@tigger.ws> wrote:
>
>
>
> On 8 Jun 2023, at 7:08 am, Jay Harbeston <jharbestonus@gmail.com> wrote:
>
>
>
> I have created a python version of ffcut.sh and am currently making sure I
> have most of the kinks out of it.
>
> I’m thinking tomorrow I should be able to post the python version the same
> way as I did the shell version.
>
> With the python version I did not have to create the text files as
> intermediary holding arrays for data that needed to be used.
>
> It will require python version 3+.
>
> jamesWhen I created it originally, mythtranscode would not handle mp4
> streams that we were getting from the HDHRs when silicon dust did the 4 or
> so month experiment of being a content provider from the cloud. The ffmpeg
> version ffcut.sh and soon the ffcut.py version will be able to handle both
> mp4 and mpeg 2 transport streams.
>
>
I'd be interested in looking at the python script also.

BTW, I did get ffcut working for me to a point. I have to may the mysql
commands look like this if password was 1234
sudo mysql -u root -p1234

That works from the console, but not sure what will happen in a UserJob
when it encounters a sudo?

Jim A
Re: Transcode script that keeps show in Recordings [ In reply to ]
On 08/06/2023 12:45, James Abernathy wrote:
> On Wed, Jun 7, 2023 at 7:21?PM Jay Harbeston <jharbestonus@gmail.com> wrote:
>
>>
>>
>> On Jun 7, 2023, at 7:13 PM, James <jam@tigger.ws> wrote:
>>
>>
>>
>> On 8 Jun 2023, at 7:08 am, Jay Harbeston <jharbestonus@gmail.com> wrote:
>>
>>
>>
>> I have created a python version of ffcut.sh and am currently making sure I
>> have most of the kinks out of it.
>>
>> I’m thinking tomorrow I should be able to post the python version the same
>> way as I did the shell version.
>>
>> With the python version I did not have to create the text files as
>> intermediary holding arrays for data that needed to be used.
>>
>> It will require python version 3+.
>>
>> jamesWhen I created it originally, mythtranscode would not handle mp4
>> streams that we were getting from the HDHRs when silicon dust did the 4 or
>> so month experiment of being a content provider from the cloud. The ffmpeg
>> version ffcut.sh and soon the ffcut.py version will be able to handle both
>> mp4 and mpeg 2 transport streams.
>>
>>
> I'd be interested in looking at the python script also.
>
> BTW, I did get ffcut working for me to a point. I have to may the mysql
> commands look like this if password was 1234
> sudo mysql -u root -p1234
>
> That works from the console, but not sure what will happen in a UserJob
> when it encounters a sudo?
>
As I recall you can put something in the sudoers file for specific jobs and/or specific users, such
that you wouldn't require a password for that combination. If that wasn't so, half of unix wouldn't run.

--

Mike Perkins


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
-----Original message-----
From: Mike Perkins <mikep@randomtraveller.org.uk>
Sent: Thursday 8th June 2023 12:52
To: mythtv-users@mythtv.org
Subject: Re: [mythtv-users] Transcode script that keeps show in Recordings


On 08/06/2023 12:45, James Abernathy wrote:
> On Wed, Jun 7, 2023 at 7:21 PM Jay Harbeston <jharbestonus@gmail.com> wrote:
>
>>
>>
>> On Jun 7, 2023, at 7:13 PM, James <jam@tigger.ws> wrote:
>>
>>
>>
>> On 8 Jun 2023, at 7:08 am, Jay Harbeston <jharbestonus@gmail.com> wrote:
>>
>>
>>
>> I have created a python version of ffcut.sh and am currently making sure I
>> have most of the kinks out of it.
>>
>> I'm thinking tomorrow I should be able to post the python version the same
>> way as I did the shell version.
>>
>> With the python version I did not have to create the text files as
>> intermediary holding arrays for data that needed to be used.
>>
>> It will require python version 3+.
>>
>> jamesWhen I created it originally, mythtranscode would not handle mp4
>> streams that we were getting from the HDHRs when silicon dust did the 4 or
>> so month experiment of being a content provider from the cloud. The ffmpeg
>> version ffcut.sh and soon the ffcut.py version will be able to handle both
>> mp4 and mpeg 2 transport streams.
>>
>>
> I'd be interested in looking at the python script also.
>
> BTW, I did get ffcut working for me to a point. I have to may the mysql
> commands look like this if password was 1234
> sudo mysql -u root -p1234
>
> That works from the console, but not sure what will happen in a UserJob
> when it encounters a sudo?
>
As I recall you can put something in the sudoers file for specific jobs and/or specific users, such
that you wouldn't require a password for that combination. If that wasn't so, half of unix wouldn't run.

--

Mike Perkins


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



Mike,



I modified Jay's script so that it uses the /etc/mythtv/config.xml file to get the user credentials:



confxml="/etc/mythtv/config.xml"

hostname=`grep "<Host" $confxml | sed -e "s;</.*>;;" | sed -e "s;<.*>;;" | sed -e "s/  *//g"`

username=`grep "UserName" $confxml | sed -e "s;</.*>;;" | sed -e "s;<.*>;;" | sed -e "s/  *//g"`

passwd=`grep "Password" $confxml | sed -e "s;</.*>;;" | sed -e "s;<.*>;;" | sed -e "s/  *//g"`

dbname=`grep "DatabaseName" $confxml | sed -e "s;</.*>;;" | sed -e "s;<.*>;;" | sed -e "s/  *//g"`



usercreds="-h$hostname -u$username -p$passwd $dbname"

echo "User Credentials = "$usercreds





Then I modified the sql query lines to use this info, such that the first query is:


echo "mythdir=$mythdir chanid=$chanid starttimeutc=$starttimeutc "

query0="select basename from recorded where chanid = $chanid and starttime = '$starttimeutc';"



echo "query = $query0"



basename=`echo "$query0;" | mysql -N $usercreds`



echo "Basename = $basename"



By modifying it in this way, I do not need to use sudo, so long as I enable file privileges for the mysql user, as per an earlier email from me.



Obviously, I should really stop echoing the $usercreds variable :-) 



Regards,

Dave
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On Jun 8, 2023, at 6:34 AM, Lists <lists@the-pearsons.co.uk> wrote:
>
> Hi Jay,
>
> I had to make a few modifications to your ffcut.sh script to get it to work - modifying the mysql commands, slightly as they didn't work on my system as written, but I soon resolved that.
>
> The other modifications I had to make were to the ffmpeg commands, since my h264 recordings with AC3 5.1 audio were transcoding without audio - I changed the commands as follows:
>
> cmdffmpeg="ffmpeg -i $infile -t $duration -ss $ss -map 0:v -c:v copy -map 0:1 -c:a ac3 -ar 48000 $outfile"
>
> and
>
> cmdffmpeg="ffmpeg -f concat -safe 0 -i $tmpdir/filelist.txt -map 0:v -c:v copy -map 0:1 -c:a ac3 -ar 48000 $outfile"
>
> this resolved the audio problems, but I am unable to rebuild the seektable for the newly transcoded recordings
>
>

Interesting. I’ll try that on some of the other files I have. I would have that that -c copy would copy all audio streams as well as the video stream.

It has worked so far on my limited file tests I am using.


> I imagine that the ffmpeg command needs some further modification, but I have no idea what that would be - maybe this will help you, though, with your python script?
>

If it is an issue, it should as I am just using the python subprocess module to exec the cmdffmpeg string variable.

Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Thu, Jun 8, 2023 at 7:53?AM Mike Perkins <mikep@randomtraveller.org.uk>
wrote:

> On 08/06/2023 12:45, James Abernathy wrote:
> > On Wed, Jun 7, 2023 at 7:21?PM Jay Harbeston <jharbestonus@gmail.com>
> wrote:
> >
> >>
> >>
> >> On Jun 7, 2023, at 7:13 PM, James <jam@tigger.ws> wrote:
> >>
> >>
> >>
> >> On 8 Jun 2023, at 7:08 am, Jay Harbeston <jharbestonus@gmail.com>
> wrote:
> >>
> >>
> >>
> >> I have created a python version of ffcut.sh and am currently making
> sure I
> >> have most of the kinks out of it.
> >>
> >> I’m thinking tomorrow I should be able to post the python version the
> same
> >> way as I did the shell version.
> >>
> >> With the python version I did not have to create the text files as
> >> intermediary holding arrays for data that needed to be used.
> >>
> >> It will require python version 3+.
> >>
> >> jamesWhen I created it originally, mythtranscode would not handle mp4
> >> streams that we were getting from the HDHRs when silicon dust did the 4
> or
> >> so month experiment of being a content provider from the cloud. The
> ffmpeg
> >> version ffcut.sh and soon the ffcut.py version will be able to handle
> both
> >> mp4 and mpeg 2 transport streams.
> >>
> >>
> > I'd be interested in looking at the python script also.
> >
> > BTW, I did get ffcut working for me to a point. I have to may the mysql
> > commands look like this if password was 1234
> > sudo mysql -u root -p1234
> >
> > That works from the console, but not sure what will happen in a UserJob
> > when it encounters a sudo?
> >
> As I recall you can put something in the sudoers file for specific jobs
> and/or specific users, such
> that you wouldn't require a password for that combination. If that wasn't
> so, half of unix wouldn't run.
>
> --
>
> Mike Perkins
>
>
You are correct. I added this line to a /etc/sudoer.d/mysql file
mythtv ALL = NOPASSWD: /usr/bin/mysql

Jim A
Re: Transcode script that keeps show in Recordings [ In reply to ]
Dave,

> On Jun 8, 2023, at 6:34 AM, Lists <lists@the-pearsons.co.uk> wrote:
>
> Hi Jay,
>
> I had to make a few modifications to your ffcut.sh script to get it to work - modifying the mysql commands, slightly as they didn't work on my system as written, but I soon resolved that.
>
> The other modifications I had to make were to the ffmpeg commands, since my h264 recordings with AC3 5.1 audio were transcoding without audio - I changed the commands as follows:
>
> cmdffmpeg="ffmpeg -i $infile -t $duration -ss $ss -map 0:v -c:v copy -map 0:1 -c:a ac3 -ar 48000 $outfile"
>
> and
>
> cmdffmpeg="ffmpeg -f concat -safe 0 -i $tmpdir/filelist.txt -map 0:v -c:v copy -map 0:1 -c:a ac3 -ar 48000 $outfile"
>
> this resolved the audio problems, but I am unable to rebuild the seektable for the newly transcoded recordings
>


Can you do the following command on the file that has the audio go away? :

ffprobe -i file.ts


And post the results in a reply. I want to see how the audio streams get defined by ffmpeg.

Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
-----Original message-----
From: Jay Harbeston <jharbestonus@gmail.com>
Sent: Thursday 8th June 2023 15:38
To: Discussion about MythTV <mythtv-users@mythtv.org>
Subject: Re: [mythtv-users] Transcode script that keeps show in Recordings

Dave,

On Jun 8, 2023, at 6:34 AM, Lists <lists@the-pearsons.co.uk> wrote:

Hi Jay,

I had to make a few modifications to your ffcut.sh script to get it to work - modifying the mysql commands, slightly as they didn't work on my system as written, but I soon resolved that.

The other modifications I had to make were to the ffmpeg commands, since my h264 recordings with AC3 5.1 audio were transcoding without audio - I changed the commands as follows:

 cmdffmpeg="ffmpeg -i $infile -t $duration -ss $ss -map 0:v -c:v copy -map 0:1 -c:a ac3 -ar 48000 $outfile"

and

cmdffmpeg="ffmpeg -f concat -safe 0 -i $tmpdir/filelist.txt -map 0:v -c:v copy -map 0:1 -c:a ac3 -ar 48000 $outfile"

this resolved the audio problems, but I am unable to rebuild the seektable for the newly transcoded recordings



Can you do the following command on the file that has the audio go away? : 

ffprobe -i  file.ts


And post the results in a reply. I want to see how the audio streams get defined by ffmpeg.

Jay



Sadly I don't have any of those files available now, but when I was checking them the other day, there was no audio track reported by mediainfo or vlc player. When I was watching the encoding, I could see that audio was reported as zero bytes



Regards,

Dave.
Re: Transcode script that keeps show in Recordings [ In reply to ]
>
> Can you do the following command on the file that has the audio go away? :
>
> ffprobe -i file.ts
>
>
> And post the results in a reply. I want to see how the audio streams get defined by ffmpeg.
>
> Jay
>
> Sadly I don't have any of those files available now, but when I was checking them the other day, there was no audio track reported by mediainfo or vlc player. When I was watching the encoding, I could see that audio was reported as zero bytes

There may be a copy of the original file saved as file.ts.orig in your recordings directory if you didn’t add the the dontremove flag on the ffcut command .

Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
On 6/7/2023 7:08 PM, Jay Harbeston wrote:
>
> I have created a python version of ffcut.sh and am currently making sure I have most of the kinks out of it.
>
> I’m thinking tomorrow I should be able to post the python version the same way as I did the shell version.
>
> With the python version I did not have to create the text files as intermediary holding arrays for data that needed to be used.
>
> It will require python version 3+.
>
> When I created it originally, mythtranscode would not handle mp4 streams that we were getting from the HDHRs when silicon dust did the 4 or so month experiment of being a content provider from the cloud. The ffmpeg version ffcut.sh and soon the ffcut.py version will be able to handle both mp4 and mpeg 2 transport streams.
>
> Jay

One suggestion is to replace ffmpeg with mythffmpeg, since it is
included in the mythtv-common package and is essentially a renamed
ffmpeg. At least mythffmpeg is part of v32 mythtv-common. I assume it is
still packaged in later versions as well.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Wed, Jun 7, 2023 at 7:10?PM Jay Harbeston <jharbestonus@gmail.com> wrote:

>
>
> I have created a python version of ffcut.sh and am currently making sure I
> have most of the kinks out of it.
>
> I’m thinking tomorrow I should be able to post the python version the same
> way as I did the shell version.
>
> With the python version I did not have to create the text files as
> intermediary holding arrays for data that needed to be used.
>
> It will require python version 3+.
>
> When I created it originally, mythtranscode would not handle mp4 streams
> that we were getting from the HDHRs when silicon dust did the 4 or so month
> experiment of being a content provider from the cloud. The ffmpeg version
> ffcut.sh and soon the ffcut.py version will be able to handle both mp4 and
> mpeg 2 transport streams.
>
> Jay
>

I got the ffcut.sh working with mariadb queued from the mythfrontend. and
it seemed to work correctly.
What I figured out is Not only do you have to run commflag but you need to
go into edit mode in mythfrontend and load the detected commercials and
edit them if needed and then save them.

Once the user job was completed what I saw in mythfrontend was all the
metadata still in the library listing but when I played the TV show, it was
22 minutes shorter, missing the commercials. Yey.
When checking the /srv/mythtv/recordings directory I had the original .ts
file copied to .ts.orig.

So if that's what it's supposed to do, it work.

Thanks

Jim A
Re: Transcode script that keeps show in Recordings [ In reply to ]
Jim,

> On Jun 8, 2023, at 12:29 PM, James Abernathy <jfabernathy@gmail.com> wrote:
>
>
>
> On Wed, Jun 7, 2023 at 7:10?PM Jay Harbeston <jharbestonus@gmail.com <mailto:jharbestonus@gmail.com>> wrote:
>>
>>
>> I have created a python version of ffcut.sh and am currently making sure I have most of the kinks out of it.
>>
>> I’m thinking tomorrow I should be able to post the python version the same way as I did the shell version.
>>
>> With the python version I did not have to create the text files as intermediary holding arrays for data that needed to be used.
>>
>> It will require python version 3+.
>>
>> When I created it originally, mythtranscode would not handle mp4 streams that we were getting from the HDHRs when silicon dust did the 4 or so month experiment of being a content provider from the cloud. The ffmpeg version ffcut.sh and soon the ffcut.py version will be able to handle both mp4 and mpeg 2 transport streams.
>>
>> Jay
>
> I got the ffcut.sh working with mariadb queued from the mythfrontend. and it seemed to work correctly.
> What I figured out is Not only do you have to run commflag but you need to go into edit mode in mythfrontend and load the detected commercials and edit them if needed and then save them.
>
> Once the user job was completed what I saw in mythfrontend was all the metadata still in the library listing but when I played the TV show, it was 22 minutes shorter, missing the commercials. Yey.
> When checking the /srv/mythtv/recordings directory I had the original .ts file copied to .ts.orig.
>
> So if that's what it's supposed to do, it work.
>

That is correct. In the python version that I am finishing up, there will be a remove option on the command line in mythtv settings.

It will be the final parameter, and if the 4th parameter is YES, the orig backup file WILL NOT be created. If it is NO, then the orig file WILL be created.


As per another comment, I am replacing ffmpeg with mythffmpeg as well.

The file that you processed, did it have 5.1 audio? If so, I am guessing that it came through correctly after ffcut?


Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
I use https://github.com/angelaschmid/lossless_cut for saving in mythvideo

I recently updated it to python-3 locally. What I want to do is to tear out the closed caption manipulation (extracting and merging), as copying with ffmpeg does include close captions by default now.





> On 6/7/2023 7:08 PM, Jay Harbeston wrote:

>One suggestion is to replace ffmpeg with mythffmpeg



What I noticed is that one of the two (don’t remember which one) had a problem with closed captions when the first cut is not from the beginning.
Re: Transcode script that keeps show in Recordings [ In reply to ]
I use https://github.com/angelaschmid/lossless_cut for saving in mythvideo

I recently updated it to python-3 locally. What I want to do is to tear out the closed caption manipulation (extracting and merging), as copying with mkvmerge (it is mkvmerge instead of ffmpeg, sorry) does include close captions by default now.





> On 6/7/2023 7:08 PM, Jay Harbeston wrote:

>One suggestion is to replace ffmpeg with mythffmpeg



What I noticed is that one of the two (don’t remember which one) had a problem with closed captions when the first cut is not from the beginning.
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Thu, Jun 8, 2023 at 12:59?PM Jay Harbeston <jharbestonus@gmail.com>
wrote:

> Jim,
>
> On Jun 8, 2023, at 12:29 PM, James Abernathy <jfabernathy@gmail.com>
> wrote:
>
>
>
> On Wed, Jun 7, 2023 at 7:10?PM Jay Harbeston <jharbestonus@gmail.com>
> wrote:
>
>>
>>
>> I have created a python version of ffcut.sh and am currently making sure
>> I have most of the kinks out of it.
>>
>> I’m thinking tomorrow I should be able to post the python version the
>> same way as I did the shell version.
>>
>> With the python version I did not have to create the text files as
>> intermediary holding arrays for data that needed to be used.
>>
>> It will require python version 3+.
>>
>> When I created it originally, mythtranscode would not handle mp4 streams
>> that we were getting from the HDHRs when silicon dust did the 4 or so month
>> experiment of being a content provider from the cloud. The ffmpeg version
>> ffcut.sh and soon the ffcut.py version will be able to handle both mp4 and
>> mpeg 2 transport streams.
>>
>> Jay
>>
>
> I got the ffcut.sh working with mariadb queued from the mythfrontend.
> and it seemed to work correctly.
> What I figured out is Not only do you have to run commflag but you need to
> go into edit mode in mythfrontend and load the detected commercials and
> edit them if needed and then save them.
>
> Once the user job was completed what I saw in mythfrontend was all the
> metadata still in the library listing but when I played the TV show, it was
> 22 minutes shorter, missing the commercials. Yey.
> When checking the /srv/mythtv/recordings directory I had the original .ts
> file copied to .ts.orig.
>
> So if that's what it's supposed to do, it work.
>
>
> That is correct. In the python version that I am finishing up, there will
> be a remove option on the command line in mythtv settings.
>
> It will be the final parameter, and if the 4th parameter is YES, the orig
> backup file WILL NOT be created. If it is NO, then the orig file WILL be
> created.
>
>
> As per another comment, I am replacing ffmpeg with mythffmpeg as well.
>
> The file that you processed, did it have 5.1 audio? If so, I am guessing
> that it came through correctly after ffcut?
>
>
> Jay
>

This particular video was a daytime game show so might not be 5.1, but the
stats on the audio are A52 (aka ac3 A52)

It's the same spec on the original and output of ffcut. I'll look for
something 5.1 tonight during primetime.

Jim A
Re: Transcode script that keeps show in Recordings [ In reply to ]
Here is the first stab at the python version. It mimics the operation of the ffcut.sh, without all the db issues earlier mentioned, and uses the MythDB connection simplifying connection to the DB. I did change it to use mythffmpeg instead of ffmpeg. I didn’t see any differences when using it.

It does have a lot of commenting in it, so if you find problems, the log for it is our friend!

I use the following as a user job in mythtv:

/usr/local/bin/ffcut.py %DIR% %CHANID% %STARTTIMEUTC% NO >> /tmp/ffcut.log

the NO above is important as it keeps a copy of the original video as .ts.orig .


https://pastebin.com/UhW637Wv?

Hope this is useful.

Regards!

Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
On 08/06/2023 20:10, Jay Harbeston wrote:
>
> Here is the first stab at the python version. It mimics the operation of
> the ffcut.sh, without all the db issues earlier mentioned, and uses the
> MythDB connection simplifying connection to the DB. I did change it to
> use mythffmpeg instead of ffmpeg. I didn’t see any differences when
> using it.
>
> It does have a lot of commenting in it, so if you find problems, the log
> for it is our friend!
>
> I use the following as a user job in mythtv:
>
> /usr/local/bin/ffcut.py %DIR% %CHANID% %STARTTIMEUTC% NO >> /tmp/ffcut.log
>
> the NO above is important as it keeps a copy of the original video as
> .ts.orig .
>
>
> ffcut.py <https://pastebin.com/UhW637Wv>
> pastebin.com <https://pastebin.com/UhW637Wv>
> favicon.ico <https://pastebin.com/UhW637Wv>
>
> <https://pastebin.com/UhW637Wv>
>
> Hope this is useful.
>
> Regards!
>
> Jay

It's certainly interesting to see how this job might be done in python,
but I'm a little concerned about its direct modification of the DB.

There are four mysqlupd instances and although they may well work as
intended I think I would be careful about using it on a system with a
'valuable' database.

Just saying :-)

John P

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Transcode script that keeps show in Recordings [ In reply to ]
-----Original message-----
From: Jay Harbeston <jharbestonus@gmail.com>
Sent: Thursday 8th June 2023 15:58
To: Discussion about MythTV <mythtv-users@mythtv.org>
Subject: Re: [mythtv-users] Transcode script that keeps show in Recordings



Can you do the following command on the file that has the audio go away? : 

ffprobe -i  file.ts


And post the results in a reply. I want to see how the audio streams get defined by ffmpeg.

Jay

Sadly I don't have any of those files available now, but when I was checking them the other day, there was no audio track reported by mediainfo or vlc player. When I was watching the encoding, I could see that audio was reported as zero bytes

There may be a copy of the original file saved as  file.ts.orig in your recordings directory  if you didn’t add the the dontremove flag on the ffcut command . 

Jay



I'm just transcoding another file with your ffmpeg commands - this is the ff0.log contents:

dave@mythtv:/tmp/myth297314$ tail -f ff0.log 

  Stream #0:1[0x1100]: Audio: ac3 ([129][0][0][0] / 0x0081), 0 channels, fltp

Output #0, mpegts, to '/tmp/myth297314/tmpfile0.ts':

  Metadata:

    encoder         : Lavf59.27.100

  Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 24 tbr, 90k tbn

Stream mapping:

  Stream #0:0 -> #0:0 (copy)

Press [q] to stop, [?] for help

frame=130215 fps=5553 q=-1.0 Lsize= 5446811kB time=01:30:25.95 bitrate=8223.5kbits/s speed= 231x    

video:5298670kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.795805%



ffprobe on the original file for the above transcode looks like this:


dave@mythtv:/tmp/myth297314$ ffprobe /media/myth/tv/81003_20230529172000.ts

ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers

  built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)

 (Configuration details removed to reduce size of email message)



[mpegts @ 0x55a29ff90bc0] start time for stream 1 is not set in estimate_timings_from_pts

[mpegts @ 0x55a29ff90bc0] stream 1 : no TS found at start of file, duration not set

[mpegts @ 0x55a29ff90bc0] Could not find codec parameters for stream 1 (Audio: ac3 ([129][0][0][0] / 0x0081), 0 channels, fltp): unspecified sample rate

Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options

Input #0, mpegts, from '/media/myth/tv/81003_20230529172000.ts':

  Duration: 01:42:11.58, start: 3.014378, bitrate: 8717 kb/s

  Program 1 

  Stream #0:0[0x1011]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k tbn

  Stream #0:1[0x1100]: Audio: ac3 ([129][0][0][0] / 0x0081), 0 channels, fltp



And this is the ffprobe for the transcoded file:


dave@mythtv:/tmp/myth297314$ ffprobe tmpfile0.ts 

ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers

  built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)






Input #0, mpegts, from 'tmpfile0.ts':

  Duration: 01:30:25.67, start: 1.817000, bitrate: 8223 kb/s

  Program 1 

    Metadata:

      service_name    : Service01

      service_provider: FFmpeg

  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k tbn







Regards,

Dave.
Re: Transcode script that keeps show in Recordings [ In reply to ]
On 09/06/2023 08:00, Lists wrote:
> -----Original message-----
> *From:* Jay Harbeston <jharbestonus@gmail.com>
> *Sent:* Thursday 8th June 2023 15:58
> *To:* Discussion about MythTV <mythtv-users@mythtv.org>
> *Subject:* Re: [mythtv-users] Transcode script that keeps show in
> Recordings
>
>
>
> Can you do the following command on the file that has the
> audio go away? :
>
> ffprobe -i  file.ts
>
>
> And post the results in a reply. I want to see how the audio
> streams get defined by ffmpeg.
>
> Jay
>
>
> Sadly I don't have any of those files available now, but when I
> was checking them the other day, there was no audio track
> reported by mediainfo or vlc player. When I was watching the
> encoding, I could see that audio was reported as zero bytes
>
>
> There may be a copy of the original file saved as  file.ts.orig in
> your recordings directory  if you didn’t add the the dontremove flag
> on the ffcut command .
>
> Jay
>
>
> I'm just transcoding another file with your ffmpeg commands - this is
> the ff0.log contents:
>
> *dave@mythtv*:*/tmp/myth297314*$ tail -f ff0.log
>
>   Stream #0:1[0x1100]: Audio: ac3 ([129][0][0][0] / 0x0081), 0
> channels, fltp
>
> Output #0, mpegts, to '/tmp/myth297314/tmpfile0.ts':
>
>   Metadata:
>
>     encoder         : Lavf59.27.100
>
>   Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv,
> bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 24
> tbr, 90k tbn
>
> Stream mapping:
>
>   Stream #0:0 -> #0:0 (copy)
>
> Press [q] to stop, [?] for help
>
> frame=130215 fps=5553 q=-1.0 Lsize= 5446811kB time=01:30:25.95
> bitrate=8223.5kbits/s speed= 231x
>
> video:5298670kB audio:0kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: 2.795805%
>
>
> ffprobe on the original file for the above transcode looks like this:
>
> *dave@mythtv*:*/tmp/myth297314*$ ffprobe
> /media/myth/tv/81003_20230529172000.ts
>
> ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers
>
>   built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
>
>  (Configuration details removed to reduce size of email message)
>
>
> [mpegts @ 0x55a29ff90bc0] start time for stream 1 is not set in
> estimate_timings_from_pts
>
> [mpegts @ 0x55a29ff90bc0] stream 1 : no TS found at start of file,
> duration not set
>
> [mpegts @ 0x55a29ff90bc0] Could not find codec parameters for stream 1
> (Audio: ac3 ([129][0][0][0] / 0x0081), 0 channels, fltp): unspecified
> sample rate
>
> Consider increasing the value for the 'analyzeduration' (0) and
> 'probesize' (5000000) options
>
> Input #0, mpegts, from '/media/myth/tv/81003_20230529172000.ts':
>
>   Duration: 01:42:11.58, start: 3.014378, bitrate: 8717 kb/s
>
>   Program 1
>
>   Stream #0:0[0x1011]: Video: h264 (High) ([27][0][0][0] / 0x001B),
> yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps,
> 24 tbr, 90k tbn
>
>   Stream #0:1[0x1100]: Audio: ac3 ([129][0][0][0] / 0x0081), 0
> channels, fltp
>
>
> And this is the ffprobe for the transcoded file:
>
> *dave@mythtv*:*/tmp/myth297314*$ ffprobe tmpfile0.ts
>
> ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers
>
>   built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
>
>
>
> Input #0, mpegts, from 'tmpfile0.ts':
>
>   Duration: 01:30:25.67, start: 1.817000, bitrate: 8223 kb/s
>
>   Program 1
>
>     Metadata:
>
>       service_name    : Service01
>
>       service_provider: FFmpeg
>
>   Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B),
> yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps,
> 24 tbr, 90k tbn
>
>
>
>
> Regards,
>
> Dave.

I get that 'deja vu all over again' feeling. Perhaps try

mythffmpeg -fflags +genpts -i inputfile -acodec copy -vcodec copy
-scodec copy -f mpegts outputfile

and rebuild the seektable. Then run the script again.

https://github.com/bennettpeter/android-MythTV-Leanfront/issues/54#issuecomment-1368201782

https://github.com/MythTV/mythtv/issues/600

HTH

John P
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
-----Original message-----
From: John Pilkington <johnpilk222@gmail.com>
Sent: Friday 9th June 2023 9:34
To: mythtv-users@mythtv.org
Subject: Re: [mythtv-users] Transcode script that keeps show in Recordings


On 09/06/2023 08:00, Lists wrote:
> -----Original message-----
> *From:* Jay Harbeston <jharbestonus@gmail.com>
> *Sent:* Thursday 8th June 2023 15:58
> *To:* Discussion about MythTV <mythtv-users@mythtv.org>
> *Subject:* Re: [mythtv-users] Transcode script that keeps show in
> Recordings
>
>
>
> Can you do the following command on the file that has the
> audio go away? :
>
> ffprobe -i file.ts
>
>
> And post the results in a reply. I want to see how the audio
> streams get defined by ffmpeg.
>
> Jay
>
>
> Sadly I don't have any of those files available now, but when I
> was checking them the other day, there was no audio track
> reported by mediainfo or vlc player. When I was watching the
> encoding, I could see that audio was reported as zero bytes
>
>
> There may be a copy of the original file saved as file.ts.orig in
> your recordings directory if you didn't add the the dontremove flag
> on the ffcut command .
>
> Jay
>
>
> I'm just transcoding another file with your ffmpeg commands - this is
> the ff0.log contents:
>
> *dave@mythtv*:*/tmp/myth297314*$ tail -f ff0.log
>
> Stream #0:1[0x1100]: Audio: ac3 ([129][0][0][0] / 0x0081), 0
> channels, fltp
>
> Output #0, mpegts, to '/tmp/myth297314/tmpfile0.ts':
>
> Metadata:
>
> encoder : Lavf59.27.100
>
> Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv,
> bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 24
> tbr, 90k tbn
>
> Stream mapping:
>
> Stream #0:0 -> #0:0 (copy)
>
> Press [q] to stop, [?] for help
>
> frame=130215 fps=5553 q=-1.0 Lsize= 5446811kB time=01:30:25.95
> bitrate=8223.5kbits/s speed= 231x
>
> video:5298670kB audio:0kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: 2.795805%
>
>
> ffprobe on the original file for the above transcode looks like this:
>
> *dave@mythtv*:*/tmp/myth297314*$ ffprobe
> /media/myth/tv/81003_20230529172000.ts
>
> ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers
>
> built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
>
> (Configuration details removed to reduce size of email message)
>
>
> [mpegts @ 0x55a29ff90bc0] start time for stream 1 is not set in
> estimate_timings_from_pts
>
> [mpegts @ 0x55a29ff90bc0] stream 1 : no TS found at start of file,
> duration not set
>
> [mpegts @ 0x55a29ff90bc0] Could not find codec parameters for stream 1
> (Audio: ac3 ([129][0][0][0] / 0x0081), 0 channels, fltp): unspecified
> sample rate
>
> Consider increasing the value for the 'analyzeduration' (0) and
> 'probesize' (5000000) options
>
> Input #0, mpegts, from '/media/myth/tv/81003_20230529172000.ts':
>
> Duration: 01:42:11.58, start: 3.014378, bitrate: 8717 kb/s
>
> Program 1
>
> Stream #0:0[0x1011]: Video: h264 (High) ([27][0][0][0] / 0x001B),
> yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps,
> 24 tbr, 90k tbn
>
> Stream #0:1[0x1100]: Audio: ac3 ([129][0][0][0] / 0x0081), 0
> channels, fltp
>
>
> And this is the ffprobe for the transcoded file:
>
> *dave@mythtv*:*/tmp/myth297314*$ ffprobe tmpfile0.ts
>
> ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers
>
> built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
>
>
>
> Input #0, mpegts, from 'tmpfile0.ts':
>
> Duration: 01:30:25.67, start: 1.817000, bitrate: 8223 kb/s
>
> Program 1
>
> Metadata:
>
> service_name : Service01
>
> service_provider: FFmpeg
>
> Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B),
> yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps,
> 24 tbr, 90k tbn
>
>
>
>
> Regards,
>
> Dave.

I get that 'deja vu all over again' feeling. Perhaps try

mythffmpeg -fflags +genpts -i inputfile -acodec copy -vcodec copy
-scodec copy -f mpegts outputfile

and rebuild the seektable. Then run the script again.

https://github.com/bennettpeter/android-MythTV-Leanfront/issues/54#issuecomment-1368201782

https://github.com/MythTV/mythtv/issues/600

HTH

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

Thanks John,



Your mythffmpeg command line seems to do the trick - I can now cut the adverts form my recordings and rebuild the seektable after the transcode.



I've been modifying Jay Harbeston's ffcut.sh script, since when I first tried it, it didn't work at all with my h264 recordings - I also had to modify his sql commands, since they didn't work for me (as the user I ran the script as, in testing, does not have a mysql account), then I had to modify the ffmpeg commands for h264. My final task, since someone suggested that it isn't a good idea to directly modify the sql database from these scripts will be to use mythutil and mythcommflag in place of the sql commands.



I'll be happy to share my version of the script, so long as Jay has no objections (I'll make sure I'll credit him in the script for the 99% of the work he did)



Regards,

Dave.
Re: Transcode script that keeps show in Recordings [ In reply to ]
> On 9 Jun 2023, at 8:56 pm, Lists <lists@the-pearsons.co.uk> wrote:
>
> Thanks John,
>
> Your mythffmpeg command line seems to do the trick - I can now cut the adverts form my recordings and rebuild the seektable after the transcode.
>
> I've been modifying Jay Harbeston's ffcut.sh script, since when I first tried it, it didn't work at all with my h264 recordings - I also had to modify his sql commands, since they didn't work for me (as the user I ran the script as, in testing, does not have a mysql account), then I had to modify the ffmpeg commands for h264. My final task, since someone suggested that it isn't a good idea to directly modify the sql database from these scripts will be to use mythutil and mythcommflag in place of the sql commands.
>
> I'll be happy to share my version of the script, so long as Jay has no objections (I'll make sure I'll credit him in the script for the 99% of the work he did)
>
> Regards,
> Dave.

Dave I've got and you're welcome to if you like, an h264cut.sh. Someone here tried it and had problems, but for me it has worked flawlessly for years.
I transcode to a .ts container as I host the odd snippet (*) and .ts lets shotcut run without lip-sync problems. I use shotcut to move (no pun) the mov atom to the head to allow you to watch in a browser.
James

* https://tigger.ws/downloads/qna.mp4
Re: Transcode script that keeps show in Recordings [ In reply to ]
> Thanks John,
>
> Your mythffmpeg command line seems to do the trick - I can now cut the adverts form my recordings and rebuild the seektable after the transcode.
>
> I've been modifying Jay Harbeston's ffcut.sh script, since when I first tried it, it didn't work at all with my h264 recordings - I also had to modify his sql commands, since they didn't work for me (as the user I ran the script as, in testing, does not have a mysql account), then I had to modify the ffmpeg commands for h264. My final task, since someone suggested that it isn't a good idea to directly modify the sql database from these scripts will be to use mythutil and mythcommflag in place of the sql commands.
>


I have since created a python version of the script that no longer has to deal with all the user /password problems as well as file permissions problems.

https://pastebin.com/UhW637Wv?


In addition , it will perform cuts based on what has been defined when editing on any transport stream files no matter what type.
mythffmpeg does is copy from the original files to the new file made up of the cut segments from editing. You shouldn’t need to do anything to them unless you are converting the video at the same time.

.
> I'll be happy to share my version of the script, so long as Jay has no objections (I'll make sure I'll credit him in the script for the 99% of the work he did)

I don’t mind if you share you versions.

I do want to keep my version separate since it does not alter the video stream in any way except for removing the defined cuts, no matter what type of video is in the TS file.

Regards!

Jay
Re: Transcode script that keeps show in Recordings [ In reply to ]
>
> It's certainly interesting to see how this job might be done in python, but I'm a little concerned about its direct modification of the DB.
>
> There are four mysqlupd instances and although they may well work as intended I think I would be careful about using it on a system with a 'valuable' database.
>
> Just saying :-)


John, et al.,

If I were to want to do it the ‘mythtv’ way, I know I would need to call the api’s within mythtv.

Not sure how to do both 1 and 2 below yet..

1. I need to get the recordings directory
2. Frame rate and framecount for the video

3. I would need to get a list of cutpoints that need to be processed.. Using GetRecordedCutList api.

Updates/inserts/deletes.

1. Update the recorded table. I suspect I can create a new job rebuilding the seek table that also sets the file size?
2. Clear the recorded markup table . Not sure what does this? Rebuilding seek table??
3. Clear the recorded seek table. I’m guessing this happens in rebuilding the seek table?
4. Add job entries for the rebuildseektable from API ?or run the following command?


Thanks!

Jay


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Transcode script that keeps show in Recordings [ In reply to ]
-----Original message-----
From: Jay Harbeston <jharbestonus@gmail.com>
Sent: Friday 9th June 2023 14:45
To: Discussion about MythTV <mythtv-users@mythtv.org>
Subject: Re: [mythtv-users] Transcode script that keeps show in Recordings


>
> It's certainly interesting to see how this job might be done in python, but I'm a little concerned about its direct modification of the DB.
>
> There are four mysqlupd instances and although they may well work as intended I think I would be careful about using it on a system with a 'valuable' database.
>
> Just saying :-)


John, et al.,

If I were to want to do it the 'mythtv' way, I know I would need to call the api's within mythtv.

Not sure how to do both 1 and 2 below yet..

1. I need to get the recordings directory
2. Frame rate and framecount for the video

3. I would need to get a list of cutpoints that need to be processed.. Using GetRecordedCutList api.

Updates/inserts/deletes.

1. Update the recorded table. I suspect I can create a new job rebuilding the seek table that also sets the file size?
2. Clear the recorded markup table . Not sure what does this? Rebuilding seek table??
3. Clear the recorded seek table. I'm guessing this happens in rebuilding the seek table?
4. Add job entries for the rebuildseektable from API ?or run the following command?


Thanks!

Jay


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

Hi Jay,



I don't think reading the database is a problem, but if there is an API to get the information for the cutlists etc, then that saves any problems with mysql accounts



For the updates, I've used these commands:


# Clear bookmarks, cutlist, seektable, and setmarkup

echo "Clearing bookmarks, cutlist and the seektable"

/usr/bin/mythutil --chanid $chanid --starttime $starttimeutc --clearbookmarks

/usr/bin/mythutil --chanid $chanid --starttime $starttimeutc --clearcutlist

/usr/bin/mythutil --chanid $chanid --starttime $starttimeutc --clearseektable



# Rebuild the seektable with mythcommflag --rebuild

echo "/usr/bin/mythcommflag --rebuild --chanid $chanid --starttime $starttimeutc"

/usr/bin/mythcommflag --rebuild --chanid $chanid --starttime $starttimeutc



I haven't been able to find a way, yet, to update the file size and clear the recordedmarkup table for the recording without updating with sql commands



Regards,

Dave.
Re: Transcode script that keeps show in Recordings [ In reply to ]
On Thu, Jun 8, 2023 at 12:59?PM Jay Harbeston <jharbestonus@gmail.com>
wrote:

> Jim,
>


> That is correct. In the python version that I am finishing up, there will
> be a remove option on the command line in mythtv settings.
>
> It will be the final parameter, and if the 4th parameter is YES, the orig
> backup file WILL NOT be created. If it is NO, then the orig file WILL be
> created.
>
>
> As per another comment, I am replacing ffmpeg with mythffmpeg as well.
>
> The file that you processed, did it have 5.1 audio? If so, I am guessing
> that it came through correctly after ffcut?
>
>
> Jay
>

I got a 5.1 show recorded last night and corrected the commercials it found
in mythfrontend edit and saved the cut list. Then I ran fftcut.py as a
UserJob within mythfrontend. ffprobe shows that the original has 2 audio
streams: English 5.1 and Spanish stereo. The file outputted by ffcut.py
shows: only English 5.1

Jim A
Re: Transcode script that keeps show in Recordings [ In reply to ]
>
>
> I got a 5.1 show recorded last night and corrected the commercials it found in mythfrontend edit and saved the cut list. Then I ran fftcut.py as a UserJob within mythfrontend. ffprobe shows that the original has 2 audio streams: English 5.1 and Spanish stereo. The file outputted by ffcut.py shows: only English 5.1

That’s good news. Sounds like it is getting getting just the ‘default’ or stream 0 audio track when using copy option for audio.

If for some reason you wanted the other audio track, you would want to mod the ffmpeg line to copy the other audio stream.

****************

As a side note, I have done some ’sleuthing’ on the ‘-c copy’ option for ffmpeg/mythffmpeg and it copies audio, video, subtitles, and data by default.

If there were subtitles or extra data on the original, then they would also be copied straight thru when processing.

Jay