Commit Graph

49 Commits

Author SHA1 Message Date
1e8a1d861f myth-merge-two-recordings now outsources to finding the next or
or previous recording on the same channel, that may overlap or abut
the current one.

To avoid error in the concatenation, we drop unknown streams and data streams.
2022-05-12 11:43:31 -05:00
9ce8047004 set autoexpire=0, preserve=1 for transcoded files
We should set the duration, too.
2022-05-12 11:42:14 -05:00
292714e85f change the default to #t for scale?
in ffmpeg-split+scale+transcode-recording
2022-05-12 11:40:23 -05:00
19205b6847 remove any data streams when using concat muxer
the scte_35 data stream can cause an ffmpeg error
2021-08-07 20:49:45 -05:00
e7f256468e add wildcard to end of expired filename
To ensure that associated pngs, etc, are also deleted.
2021-04-28 06:30:17 -05:00
b5cead5760 add / separator to pathnames 2021-04-28 06:25:34 -05:00
d88a8b9e9e use the new code in ffmpeg-myth.scm to cull old files 2021-04-27 11:42:08 -05:00
3cb6c612e3 revert to slow preset, add code for cleaning up transcoded files
ltbtranscodedtobedeleted table in mythconverg has been added:

CREATE TABLE `ltbtranscodedtobedeleted` (
  `basename` varchar(256) NOT NULL,
  `deleted` tinyint(1) NOT NULL DEFAULT '0',
  `expirydate` datetime NOT NULL,
  `updatetimestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8
2021-04-27 11:38:16 -05:00
72a5d896ee add MYTH-MERGE-TWO-RECORDINGS and FFMPEG-REMUX-TO-H264-TS
MYTH-MERGE-TWO-RECORDINGS takes a recording chanid and starttime and
finds the next recording on that same chanid and uses the concat muxer
to merge the two files. The recording information is updated in
mythconverg.

We should check for compatibility, but don't at the moment.

FFMPEG-REMUX-TO-H264-TS remuxes a recording into an mpegts
container. The name is somewhat wrong, because it does not transcode
to h264, but the main use is in converting matroska to mpegts
containers, and all my mkvs use h264-encoded video.
2021-04-18 06:58:31 -05:00
23d4e73ed6 improve RECORDING-NEW-FILE-NAME
With the new file endings, we need to split file names at #\. and pick
up the beginning (e.g. 1031_20210405000300) and add
ending (e.g. h264.ts) but drop any middle parts.
2021-04-18 06:55:59 -05:00
bbb8b1a094 don't use ext, so remove it 2021-04-18 06:55:32 -05:00
d97779eacd update the list of file endings 2021-04-18 06:55:10 -05:00
a483779bc1 Compensate for ffprobe deficiency in probing h265-encoded files
The current version of ffprobe,

ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers

prints a value of 0 for each frame number in an h265-encoded
mpegts. So, we need to count for ourselves.

----

Experiments with h265-encoded videos shows that there is great
compression (~30-40% better than h264), but:

-the mythling player on android can't play them;
-the 8-yr old asus frontend can play cartoons fine, but not
 "real-life" video
-transcoding is about 1/3 the speed with libx265 vs. libx264

I will revisit the issue when one of the first two points makes it
possible, but until one of them needs to be replaced, I will stick
with h264.
2021-04-18 06:46:48 -05:00
eb0f6c85cc Add map-cons
This idiom of converting a list (L1 L2) of two lists into a list of
cons cells was appearing in a few places, so add a function to
encapsulate it.
2021-04-18 06:44:01 -05:00
80111fa2ec in SHELL-COMMAND-TO-STRING, throw an error upward
We want to treat all errors in SHELL-COMMAND-TO-STRING as fatal unless
the caller installs a handler for ERROR-IN-SHELL-COMMAND-TO-STRING.
2021-04-18 06:42:22 -05:00
af706d5d4b sharpen transcoding options, add choice for muxer
In v31 of mythtv, playback and editing of matroska-formatted
containers does not work well--seeking is broken so bookmarks,
jumping, etc. do not work.

So, an option to set the container format/muxer has been added to
FFMPEG-SPLIT+TRANSCODE-RECORDING, namely FFMPEG-TRANSCODED-FILE-MUXER,
and this is set to mpegts by default.

Because we relied on defaults for the matroska container, we have made
some things explicit (like using libx264 for the video codec). The
preset is also now veryfast, rather than slow, which is a recommended
setting on the ffmpeg users' mailing list.

FFMPEG-SPLIT+TRANSCODE-RECORDING also uses FFMPEG-TRANSCODING-OPTIONS
now, rather than hard-coded options.
2021-04-18 06:34:59 -05:00
265905ff90 start jobs with the greatest niceness 2021-04-18 06:33:41 -05:00
22319f14a3 a draft of split+scale+... transcoder 2021-01-21 20:33:41 -06:00
084cc7f63f tag the recording record depending on success of updating db 2021-01-21 20:32:49 -06:00
f999148fc4 allow re-create-record-data to pass recording records unaltered 2021-01-21 20:31:28 -06:00
def854296e mythtv-make-concat-list: handle empty cut list
If cut list is empty, set it to ((0 0)), so that concat list ends up
being ((0 N)) where N is either the last i-frame number or
greatest-fixnum.

When fed to the concat filter in ffmpeg-split+transcode-recording, the
recording will be transcoded.
2021-01-21 20:24:25 -06:00
f3c0d86d71 filter out any recordings in the Deleted group
Do not transcode a recording in the Deleted group.
2021-01-07 20:28:10 -06:00
61dc6756d6 ensure that I-frames have valid data
With the current ffprobe [1], time or frame numbers for an I-frame may be
output that are invalid (N/A).

[1] ffprobe version 3.4.8-0ubuntu0.2 Copyright (c) 2007-2020 the FFmpeg developers
2021-01-07 20:24:10 -06:00
ea76a163a8 add mythconverg-update-recordedmarkup-table-rollback
A function to rollback a transcoding. It assumes that the original
file has not been altered in any way.
2020-12-08 12:52:18 -06:00
a16b9aaa99 Skip an I-frame that does not have a numeric PTS
In some older video files, ffprobe returns N/A (and possibly other
non-numeric data) when it can't determine the PTS. These cause
problems and ruin a transcode.
2020-12-08 12:47:06 -06:00
bbb2c1ebf7 add a recording-filesize function 2020-12-08 12:46:49 -06:00
fba4b359fa add a write-to-file function for exporting stuff 2020-12-08 12:46:16 -06:00
35d0099e40 Use duration (-t) not end time (-to) for inputs
In older versions of ffmpeg (incl. ffmpeg version 3.4.8-0ubuntu0.2 ),
using the end-time (-to) causes a syntax error, so we need to switch
to using the duration.
2020-12-08 12:42:46 -06:00
6dca224ea2 use the system binaries for ffmpeg and ffprobe
The library mis-match on ubuntu 18.04 seems impossible to fix, so
revert to using the system binaries.

This makes including a subtitle stream impossible for now, but moving
to the concat *filter* had made that pretty much impossible anyway,
because ffmpeg (even in HEAD) does not set the right PTS when the
input is in matroska format.
2020-12-08 12:38:57 -06:00
c844f0303c allow command-line option to set up job 2020-10-23 13:26:02 -05:00
e5270ae588 ensure that the start of next cut is after end of current cut 2020-10-23 13:25:12 -05:00
Leo Butler
832580ea6a constants for the recordedmarkup table in scheme 2020-07-27 17:33:47 -05:00
Leo Butler
d3e1e370e5 mythconverg schema for v28 2020-07-27 17:33:47 -05:00
Leo Butler
9de80e032d A kludge to deal with problematic library upgrades
The release upgrade from 16.04 to 18.04 was not seamless.

LD_LIBRARY_PATH= ld ffmpeg.git/ffmpeg

ld: warning: libcdio_paranoia.so.1, needed by //usr/lib/x86_64-linux-gnu/libavdevice-ffmpeg.so.58, not found (try using -rpath or -rpath-link)
ld: warning: libcdio_cdda.so.1, needed by //usr/lib/x86_64-linux-gnu/libavdevice-ffmpeg.so.58, not found (try using -rpath or -rpath-link)
ld: warning: libbluray.so.1, needed by //usr/lib/x86_64-linux-gnu/libavformat-ffmpeg.so.58, not found (try using -rpath or -rpath-link)
ld: warning: libx265.so.79, needed by //usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.so.58, not found (try using -rpath or -rpath-link)
2020-07-27 17:33:47 -05:00
Leo Butler
306bd7c0ce correct the finding of nearest i-frames
the original code used >= or <= as the test, but the code actually
implemented > or <. This causes an ffmpeg error when there is only 1
i-frame between the lower and upper bound.
2020-07-27 17:33:47 -05:00
Leo Butler
88dcc5b470 add debugging print out in shell-command-to-string 2020-07-27 17:33:47 -05:00
Leo Butler
076164e4a0 clear cutlist commflagged bookmark and set transcoded 2020-07-27 17:33:47 -05:00
Leo Butler
0839a6be14 change csv-parser to ffprobe-out-parser
use #\page as the separator for ffprobe 'csv' output
2020-07-27 17:33:47 -05:00
Leo Butler
f37ec47ee1 set PATH variable 2020-07-27 17:33:47 -05:00
Leo Butler
4335a8d9dd a cron job launcher for ffmpeg-myth.scm 2020-07-27 17:33:47 -05:00
Leo Butler
37a2c8df05 a guile scheme re-implementation
-use the concat filter rather than segment+concat muxers
-currently, do not create a separate subtitle stream from closed
captions

-ffmpeg-myth-do-pending-jobs will look up recordings with a cutlist and
 run the transcoder (ffmpeg-myth-cut) over each
2020-07-27 17:33:47 -05:00
Leo Butler
0137380569 a start at using elisp+comint-mode
abandoned in favour of scheme
2020-07-27 17:33:47 -05:00
Leo Butler
5fafa809e0 clean up transcoded files
TODO: use the db to find these files
2020-07-27 17:33:47 -05:00
Leo Butler
81912155c1 core sh scripts for transcoding to h264 in mkv 2020-07-27 17:33:47 -05:00
Leo Butler
763f589be1 scripts to remove cut or skip lists
Uses the concat muxer
2020-07-27 17:33:47 -05:00
Leo Butler
131e2fa645 a job launcher
passes most settings through environment variables
2020-07-27 17:33:47 -05:00
Leo Butler
64766508f0 cron script to clean up files
clean files that have been transcoded
2020-07-27 17:33:47 -05:00
Leo Butler
12d992fa94 initial commit 2020-07-27 17:33:47 -05:00
8849d0b087 Initial commit 2020-06-15 16:25:50 +00:00