[mythtv-users] automatic transcoding?

Roland Ernst rcrernst at gmail.com
Fri Nov 22 17:36:11 UTC 2024


On Fri, Nov 22, 2024 at 2:48 AM James Abernathy <jfabernathy at gmail.com>
wrote:

> On Thu, Nov 21, 2024 at 8:19 PM David Hampton via mythtv-users
> <mythtv-users at mythtv.org> wrote:
> >
> > On Wed, 2024-11-20 at 05:51 -0500, James Abernathy wrote:
> > > On Wed, Nov 20, 2024 at 12:50 AM David Hampton via mythtv-users
> > > <mythtv-users at mythtv.org> wrote:
> > >
> > > > That's the one.  When I select it, I get a menu with six items that
> > > > start with "Default" and end with "Lossless".  The last one is
> > > > always
> > > > my choice.  The others fail out.
> > > >
> > > > David
> > > >
> > > Well, I'm on v34 latest
> > > (fixes/34(v34.0+fixes.202411041418.c376437559~ubuntu24.04.1)
> > >
> > > When I'm in mythfrontend in Watch Recording, if I right arrow on a
> > > recording -> down arrow to Job Options -> right arrow on Begin
> > > Transcoding I see a list of:
> > > Default
> > > Autodetect
> > > High Quality
> > > Medium Quality
> > > Low Quality
> > > Default
> > >
> > > I don't have a lossless, but Default is listed first and last.
> >
> > Lossless should be last.  I haven't looked at the code, but maybe its a
> > theming problem.  What theme are you using?  Have you tried choosing
> > the second "Default" entry?
> >
> > David
>
>
> I tested a number of different themes. They all have the same list as
> above with no lossless and 2 Defaults.
>
> I looked at the Web App where you can launch jobs, but transcoding is
> with the default profile
>
>
Ad *enabling lossless transcode in the transcode menu* of the frontend:
Back in time, with the old GUI, this setting was available in mythtv-setup.

*Analysis:*

The transcoding profile menues are created in
playbackbox.cpp: line 3068
MythMenu* PlaybackBox: create TranscodingProfilesMenue()
https://github.com/MythTV/mythtv/blob/447ea618b2950f/mythtv/programs/mythfrontend/playbackbox.cpp#L3068
creates menu entries for
- Default
- Autodetect
- High Quality
- Medium Quality
- Low Quality

and all the additional profiles which have been set up manually and belong
to profilegroup 'Transcoders'.

Autodetect:
transcode.cpp: line 81
bool Transcode:GetProfile
https://github.com/MythTV/mythtv/blob/447ea618b2950f/mythtv/programs/mythtranscode/transcode.cpp#L81
'Autodetect' selects the profile 22 with name 'MPGE2' for 'Transcoders' for
ts files containing mpeg2 videos.
The profile 'Autodetect' is used if you select it in the transcoding job
menue or if you do not specify
a profile in the transcoding job.

*Resolution:*

One can create an additional transcoding profile that does lossless
transcode,
I used mythtv-setup for that:

3. Recording Profiles --> Transcoders -> Create New Profile
name it "lossless-mpeg2".
This creates a new entry, one needs to edit that profile:
Right arrow on the new profile, select "Video Compression"
right arrow and select "Codec" "RTjpeg".
Save it by pressing left arrow multiple times until the exit dialog.


Now it comes to the tricky part:
If that profile contains the setting "transcodelossless" with value 1,
mythtranscode switches to lossless mpeg2 transcoding.
See file transcode.cpp and search for "transcodelossless":
https://github.com/MythTV/mythtv/blob/447ea618b2950f/mythtv/programs/mythtranscode/transcode.cpp#L619

You need the mysql console for adding this new setting:
> select * from recordingprofiles where name = 'lossless-mpeg2';
remember the 'id' value
> insert into codecparams (`profile`, `name`, `value`) VALUES (<above
id-value>, 'transcodelossless', 1);

Restart backend.
You should now see the new profile when you select the job "Transcode" on
an 'ts' file containing mpeg2 video.
Logging is done in the mythtranscode.log file.

I you want to set lossless transcoding in general,
modify the recording profile 'MPEG2','RTjpeg' used by the 'autodetect'
profile selection:
You do not need to create a new profile, run in the mysql console

> SELECT r.id FROM recordingprofiles r, profilegroups p
 WHERE r.profilegroup = p.id AND p.name = 'Transcoders'
 AND r.name = 'MPEG2';

This should result in "22".

> SELECT * from codecparams where `profile` = 22
 AND `name` = 'transcodelossless';

If that entry exists, but is zero:
> UPDATE codecparams SET `value` = 1 WHERE
`profile` = 22 AND `name` = 'transcodelossless';

If that entry does not exist:
> INSERT INTO `codecparams` (`profile`, `name`, `value`) VALUES
(22,'transcodelossless',1);

*Additional info:*
The global setting "SaveTranscoding" will guide the transcoder not
to delete the original file. It will be renamed as '<file>.ts.old'.
This may help you to restore the file, if transcoding went bad.

HTH, Roland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20241122/cd56f349/attachment.htm>


More information about the mythtv-users mailing list