Commit Graph

36 Commits

Author SHA1 Message Date
Leo Butler d7c65c65d1 correct typo 2022-05-12 12:03:20 -05:00
Leo Butler f20aa31a72 ffmpeg-myth1, ffmpeg-myth0 update
ffmpeg-myth1: check the recording basename of the rec and tr-rec, if
they are equal, don't schedule a deletion

ffmpeg-myth0: institute an error handler around ffmpeg-myth1

ffmpeg-myth-do-pending-jobs: institute job control to prevent a collision
2022-05-12 11:47:58 -05:00
Leo Butler 599e269e67 myth-move-and-symlink-watched-files
Move a watched, transcoded file from recordings directory to watched-recordings.
2022-05-12 11:46:04 -05:00
Leo Butler 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
Leo Butler 9ce8047004 set autoexpire=0, preserve=1 for transcoded files
We should set the duration, too.
2022-05-12 11:42:14 -05:00
Leo Butler 292714e85f change the default to #t for scale?
in ffmpeg-split+scale+transcode-recording
2022-05-12 11:40:23 -05:00
Leo Butler 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
Leo Butler 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
Leo Butler b5cead5760 add / separator to pathnames 2021-04-28 06:25:34 -05:00
Leo Butler 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,
2021-04-27 11:38:16 -05:00
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

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
Leo Butler 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
Leo Butler bbb8b1a094 don't use ext, so remove it 2021-04-18 06:55:32 -05:00
Leo Butler d97779eacd update the list of file endings 2021-04-18 06:55:10 -05:00
Leo Butler 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
Leo Butler 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
Leo Butler 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
Leo Butler 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
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.

now, rather than hard-coded options.
2021-04-18 06:34:59 -05:00
Leo Butler 22319f14a3 a draft of split+scale+... transcoder 2021-01-21 20:33:41 -06:00
Leo Butler 084cc7f63f tag the recording record depending on success of updating db 2021-01-21 20:32:49 -06:00
Leo Butler f999148fc4 allow re-create-record-data to pass recording records unaltered 2021-01-21 20:31:28 -06:00
Leo Butler 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

When fed to the concat filter in ffmpeg-split+transcode-recording, the
recording will be transcoded.
2021-01-21 20:24:25 -06:00
Leo Butler 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
Leo Butler 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
Leo Butler 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
Leo Butler 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
Leo Butler bbb2c1ebf7 add a recording-filesize function 2020-12-08 12:46:49 -06:00
Leo Butler fba4b359fa add a write-to-file function for exporting stuff 2020-12-08 12:46:16 -06:00
Leo Butler 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
Leo Butler 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
Leo Butler e5270ae588 ensure that the start of next cut is after end of current cut 2020-10-23 13:25:12 -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 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

-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