Page 1 of 1

seeking/editing in mythfrontend

Posted: Sun Apr 11, 2021 12:18 am
by leobutler
I use ffmpeg to transcode my recordings to an x264-encoded video stream in a matroska container. I use ffprobe to update the recordedseek table after transcoding, and update the entry in the recorded table so that I can watch the transcoded recording in Recordings. I have been doing this for a couple years.

In both v0.28 and v0.29 (from the mythbuntu ppa), I was able to seek and edit these mkv files without difficulty. In v0.31/fixes from the same ppa, seeking and editing is broken for these transcoded files--it appears that any movement in the video is only by a keyframe. Playback is otherwise fine.

Seeking and playback are fine in vlc and ffplay. This is true if I move the file to Videos, too (I don't know about editing, because it lacks a seektable).

This seems like a regression to pre v0.28 behaviour.

Has anyone seen similar behaviour? Ideas about what caused the regression?

At the moment, I have re-worked my transcoding to use an mpegts container, and that works ok, but I really prefer the matroska, so I would like to know how to fix the problem.

TIA,
Leo

(I posted this to the mythtv email list at the end of March
http://lists.mythtv.org/pipermail/mytht ... 06779.html.)

Re: seeking/editing in mythfrontend

Posted: Sun Apr 11, 2021 9:22 am
by kmdewaal
Hi Leo,

As this seems to be a bug, I suggest that you create a Github issue for this. That will at least make certain that it is not forgotten, which unfortunately does happen occasionally when issues cannot be resolved immediately. The Github issue list is the poster board where devs can look at whenever they are bored.

Thanks,
Klaas.

Re: seeking/editing in mythfrontend

Posted: Sun Apr 11, 2021 10:09 am
by Steve Goodey
... devs can look at whenever they are bored.
:lol:

Re: seeking/editing in mythfrontend

Posted: Sun Apr 11, 2021 11:49 am
by leobutler
kmdewaal wrote:
Sun Apr 11, 2021 9:22 am
As this seems to be a bug, I suggest that you create a Github issue for this.
Thanks, Klaas. I have filed a bug report https://github.com/MythTV/mythtv/issues/353.

Re: seeking/editing in mythfrontend

Posted: Sun Apr 11, 2021 7:03 pm
by blm-ubunet
I recall the decision was to NOT generate seektables for mkv containers.
The fact it did work was an oversight.
[Myth]FFprobe does not update any seektable, do you refer to mythcommflag --rebuild ..

MKV design was meant to be be so clever it did not need a seektable shame about the timebase deficiencies.
MPEG-TS probably is the better container.

Re: seeking/editing in mythfrontend

Posted: Mon Apr 12, 2021 12:22 am
by leobutler
blm-ubunet wrote:
Sun Apr 11, 2021 7:03 pm
I recall the decision was to NOT generate seektables for mkv containers.
The fact it did work was an oversight.
[Myth]FFprobe does not update any seektable, do you refer to mythcommflag --rebuild ..

MKV design was meant to be be so clever it did not need a seektable shame about the timebase deficiencies.
MPEG-TS probably is the better container.
The issue is not about seektables per se, but the mythfrontend playback of mkv containers. In Videos, seeking works correctly (without a seektable) as I wrote, but in Recordings neither seeking nor editing works (with or without a seektable).

I use some handwritten scheme code to do the transcoding and updating of the mythconverg database. And I need to use ffprobe to generate the data for the recordedseek table, because mythcommflag does not understand matroska containers (and it also fails with libx265+mpegts). With a seektable, in v0.29, I could edit mkv files using the mythfrontend player.

For my purposes, matroska is much better than mpegts, but I can understand that preferences differ.

Re: seeking/editing in mythfrontend

Posted: Mon Apr 12, 2021 5:39 pm
by paulh
MythTV has never created or used mkv files for recordings so I'm with blm-ubunet on this one if it ever did work it was a fluke and not by design :? :roll:

Also are you sure ffprobe is creating the seek tables that doesn't sound possible :?:

Re: seeking/editing in mythfrontend

Posted: Mon Apr 12, 2021 8:08 pm
by leobutler
paulh wrote:
Mon Apr 12, 2021 5:39 pm
MythTV has never created or used mkv files for recordings so I'm with blm-ubunet on this one if it ever did work it was a fluke and not by design :? :roll:
Paul, what you say may be true, but why would the video player and recordings player treat these mkv files differently?
paulh wrote:
Mon Apr 12, 2021 5:39 pm
Also are you sure ffprobe is creating the seek tables that doesn't sound possible :?:
After transcoding, I use ffprobe to extract the i-frame data, and update mythconverg's recordedseek and markup tables from that.
See https://git.sdf.org/nb0yjxtr/ffmpeg-myt ... h.scm#L515

Leo

Re: seeking/editing in mythfrontend

Posted: Tue Apr 13, 2021 8:41 am
by blm-ubunet
I figured out later that you must be generating the keyframe offsets with external tool & stuffing back into DB.
That's a clever trick..
That might only work for video & audio packets without byte offsets.
Almost all broadcast mpeg-ts has an offset in AV packets (with same PTS) & never uses IDR I frames..
AIUI Mythtv uses the first video packet as time zero, almost all other AV software (mkvtoolnix, vlc etc) uses the first (earliest PTS).
I've struggled to find a ffmpeg/ffprobe/mediainfo cmd to extract that offset.

Mythtv's recorder needs a parser to find keyframes.
And the H265 parser has only just been added (I think).

You can generate seektables for videos.
But something about playback must have changed..

Re: seeking/editing in mythfrontend

Posted: Wed Apr 14, 2021 1:49 pm
by paulh
leobutler wrote:
Mon Apr 12, 2021 8:08 pm
After transcoding, I use ffprobe to extract the i-frame data, and update mythconverg's recordedseek and markup tables from that.
See https://git.sdf.org/nb0yjxtr/ffmpeg-myt ... h.scm#L515
That would be an important point to put on the issue. We wouldn't want a dev spend days tracking down the problem only to find later it was down to something like this would we :roll: