Open marillat opened 2 years ago
The libmpeg2 headers are not self-sufficient, i.e. they will not compile on their own. To work around this, replace /mythtv/configure line 6066 with:
check_lib libmpeg2external "stdint.h mpeg2dec/mpeg2.h" mpeg2_init -lmpeg2 || disable libmpeg2external
This should make the --enable-libmpeg2external
flag work. However, this also disables mythtranscode, which is the only user of libmpeg2, specifically the files mpeg2fix.(h|cpp).
Notably, mpeg2fix.cpp uses information only exposed in mpeg2_internal.h, specifically in the MPEG2fixup::BuildFrame() function https://github.com/MythTV/mythtv/blob/94f61679d476bd0b415c393a704d855def1b8a07/mythtv/programs/mythtranscode/mpeg2fix.cpp#L1202.
Because of this, it would be better to rewrite mpeg2fix to use only FFmpeg.
(As an aside, mpeg2fix is a terrible name; lossless transcode is probably better.)
@ulmus-scott mythtranscode needs rewriting anyway to be able to losslessly transcode all the newer formats (eg. H264, H265 etc) and not just mpeg2!!!!
@ulmus-scott mythtranscode needs rewriting anyway to be able to losslessly transcode all the newer formats (eg. H264, H265 etc) and not just mpeg2!!!!
Or just remove mythtranscode entirely, and recommend using other tools (ffmpeg, handbrake, other) for transcode, and tools such as the Lossless cut scripts on the wiki for commercial removal which support other codecs. Perhaps keeping around script named mythtranscode to invoke those other programs using the existing command line flags for compatibility?
Or just remove mythtranscode entirely, ...
Excuse me for butting in, but would this break/cause problems with MythArchive?
@stuarta mythtranscode needs rewriting anyway to be able to losslessly transcode all the newer formats (eg. H264, H265 etc) and not just mpeg2!!!!
BuildFrame() seems to decode a video packet with libmpeg2 and then add it to the FFmpeg output, encoding the frames as intra-frames only using the highest quality setting. I see no inherent reason that would prevent this from being done in a codec-agnostic manner with FFmpeg.
@garybuhrmaster Or just remove mythtranscode entirely, ...
@Steve-Goodey Excuse me for butting in, but would this break/cause problems with MythArchive?
Mythtranscode also appears to support HTTP Live Streaming.
Since MythTV already requires FFmpeg for decoding, I see no reason to not continue offering an interface in MythTV to transcode with FFmpeg.
codec-agnostic manner
Re-reading this, I think a truly agnostic approach would probably be difficult to impossible, due to the different settings for each codec. However, what I really meant was: the general idea is codec agnostic (although using i-frames only seems rather wasteful and inefficient) but would probably need an explicit specific implementation for each codec. At this time, the supported codecs for virtually lossless cutting should be at least: H.262, H.264, H.265, and maybe H.263.
I wonder if the audio cutting is similarly virtually lossless.
Could someone rename this issue to "Rewrite mythtranscode to use ffmpeg instead of libmpeg2" since that is what actually needs to be done?
I have never used this, which is in 'python' and appears to output .mkv, but it seems worth mentioning its existence.
"A python wrapper for calling external transcode utilities on recordings. Automatically handles all database operations for transcoding a file in place. "
As a second, related rewrite, mythtranscode should maybe use FFmpeg's libavformat instead of replex.
However, replex does seem to be used by MythArchive:
mythplugins/mytharchive/mytharchive/archivesettings.cpp:155: "mythreplex."));
mythplugins/mytharchive/mytharchive/archivesettings.cpp:412: "mythreplex."));
mythplugins/mytharchive/mythburn/scripts/mythburn.py:2458:# using mythreplex
mythplugins/mytharchive/mythburn/scripts/mythburn.py:2463: command = "mythreplex --demux --fix_sync -t TS -o %s " % quoteCmdArg(folder + "/stream")
mythplugins/mytharchive/mythburn/scripts/mythburn.py:2483: command = "mythreplex --demux --fix_sync -o %s " % quoteCmdArg(folder + "/stream")
mythplugins/mytharchive/mythburn/scripts/mythburn.py:2510: fatalError("Failed while running mythreplex. Command was %s" % command)
mythplugins/mytharchive/mythburn/scripts/mythburn.py:4494:# mythtranscode/mythreplex or ProjectX as the cutter/demuxer
mythplugins/mytharchive/mythburn/scripts/mythburn.py:4505:# process a single file ready for burning using mythtranscode/mythreplex
I used to be an intensive user of MythArchive. I used ProjectX as the cutter/demuxer/sync fixer - and still do, in my current cutting script for mpeg2video recordings. It appears to have been unmaintained for years, and fails with some varieties of GOP or non-monotonic timestamps, but mostly it just works.
Platform: Linux
MythTV version: Up to date fixes/31
Package version: From DMO
libmpeg2-4-dev 0.5.1-9 is installed
If the include stdint.h is put before the mpeg2dec/mpeg2.h include the build doesn"t fail.
original test.c generated by configure
Working test.c
Error log from config.ep