Newbie| How to do a convertion to mp4 after recording

For discussion of topics specific to MythTV on linux
Post Reply
pelikan
Newcomer
Posts: 3
Joined: Mon May 02, 2022 11:40 am
Germany

Newbie| How to do a convertion to mp4 after recording

Post by pelikan »

Good day,
did you have any tips how to do automatically a conversion to mp4 after recording.
I had put in mythtv-setup in task 1 "mytvtranscode" but it doesn't work.
Unfortunately i can't find a tutorial how to do that.
Any idea?

I use mythtv 32 on an Ubutun 20.4

Best wishes
LinuxGeek28
Junior
Posts: 17
Joined: Mon Dec 24, 2018 4:55 pm
United States of America

Re: Newbie| How to do a convertion to mp4 after recording

Post by LinuxGeek28 »

Although I was able to get MythTV to transcode my recordings with the default transcoder, I was unhappy with the results.
Your best bet may be the wiki:
https://www.mythtv.org/wiki/Category:Scripts
https://www.mythtv.org/wiki/Category:Perl_Scripts

There are multiple pages related to transcoding. Nuvexport seems to be the most recent.
Keep in mind that just about any script prior to version 30 will not work with your version without modification.

Many people prefer the Handbrake CLI to transcode recordings. There are numerous presets you can use.

Read a few of the wiki pages on post recording jobs and such. It seems a lot of people roll-their-own when it comes to this. Maybe someone else has done it and will share their script with you.
sleepyhead
Newcomer
Posts: 2
Joined: Fri Apr 26, 2019 11:28 am
Canada

Re: Newbie| How to do a convertion to mp4 after recording

Post by sleepyhead »

I started with the script from Mike Stucky (can't link, search for Transcode_Mpeg2_to_H264 on mythtv dot org) and modified it to pass parameters to ffmpeg that used the h/w encoders on my GPU. I then made a user job on the server, General, Job Queue (job Commands), User Job #1 as something like '/home/sleepy/bin/mythtranscode264(dot)py %JOBID%. I can now set recording rules up to use that post processing job. From the command line I can call the script manually using channel/timestamp/timezone offset. I.e. assuming my recorded file name is 16503_20201113003000.ts, I would run:

mythtranscode264(dot)py --chanid=16503 --starttime=20201113003000 --tzoffset=-5

Sometimes mucking about to find my tz offset, depending if we're in DST or not. YMMV, hope you know a little python, but your versions look like it should be compatible.

Edit: No, sorry, not compatible, I think you'll have some python version issues with 32
blm-ubunet
Senior
Posts: 265
Joined: Sun Jun 15, 2014 1:08 am
Cambodia

Re: Newbie| How to do a convertion to mp4 after recording

Post by blm-ubunet »

EU dvb recording will already be H264 video codec in mpeg2-ts transport stream container.
All you need to do it remux into a program stream container or possibly better into FOSS mkv.

mp4 refers to mpeg4 part 14 file format.
User avatar
dnalorernst
Developer
Posts: 103
Joined: Mon Feb 17, 2020 8:03 pm
Austria

Re: Newbie| How to do a convertion to mp4 after recording

Post by dnalorernst »

According to your location, you can receive
- DVB-T2 HD via antenna, as h.265 (hevc)
- DVB-S2 HD via sattelite dish, as h.264 (avc) (2)
- DVB-S SD via sattelite dish, as mpeg2-video (3)
embedded in an mpeg transport stream (4).
Which one do you use?

You have not stated why you want to convert your recordings into an mp4 format (5).
What do you expect from this recording:
For instance, the recording should be
- playable on other devices like smartphones, tablets
- without pre/post roll, i.e cut at the beginning and end
- free of embedded comercial breaks, i.e. removed commericals
- reduced in file size but keeping almost the same quality
- reduced in file dimensions, e.g. width 1080 --> 720
- deinterlaced (6)
Are there other reasons not mentioned in this list?

All above transcoding steps can be implemented as 'User Jobs' (8) within Mythtv.
The amount of needed CPU time grows in above list from 1/10 up to 2 times of
the recording duration (on an aged Core I5, 4th gen).

Is it a must to convert to mp4 or can the resulting recording in
matroska format (mkv) (7) as well?
Note, you can easily convert mp4 tp mkv and vice versa, if needed.

Do you want to keep this recording in the recording section or move it
to the video section of the media library?


(1) https://en.wikipedia.org/wiki/High_Effi ... deo_Coding
(2) https://en.wikipedia.org/wiki/Advanced_Video_Coding
(3) https://en.wikipedia.org/wiki/H.262/MPEG-2_Part_2
(4) https://en.wikipedia.org/wiki/MPEG_transport_stream
(5) https://en.wikipedia.org/wiki/MPEG-4_Part_14
(6) https://en.wikipedia.org/wiki/Deinterlacing
(7) https://en.wikipedia.org/wiki/Matroska
(8) https://www.mythtv.org/wiki/User_Jobs
Post Reply