Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#10008 closed Bug Report - General (Fixed)

mythtranscode: picture corruption and momentary stalling after cuts

Reported by: mythtv@… Owned by: beirdo
Priority: minor Milestone: 0.25
Component: MythTV - General Version: Unspecified
Severity: medium Keywords:
Cc: Ticket locked: no

Description

The purpose of this ticket is to present a patch that adds a feature ( --cleancut ) to mythtranscode. The feature provides a way to avoid 3 problems. Versions of the patch for master, fixes/0.24 and jyavenard/backports/fixes/0.24 are available from my mythtv fork at https://github.com/Glidos/mythtv. The problems are as follows.

1) Some h264 transmissions don't have any completely safe start points. They have I frames, but it is permitted to have use of reference frames across an I frame. BBC HD is the source that I've analysed the most. It has no regular IDRs, no recovery points and no use of memory operations to clear the reference list. Because of that, slight corruption can occur at the start of a transcode and at each cut point. (If you are like me, then you will find what I've just said hard to believe, but I've also found seemingly knowledgeable people on forums confirming it. Apparently decoders are supposed to work around the problem the best they can.)

2) mythtranscode in fifo mode has a very clever synchronisation mechanism that ensures the amount of video and audio sent to the fifos always corresponds with the timecodes that were associated with the data when in the source stream. The mechanism works very well when it settles down, but can produce a momentary freeze-frame effect on start up. That happens at the start and at each cut point.

3) Sometimes the video from just after the end of cut gets encoded with the audio from just after the beginning of cut (that's audio that shouldn't really be present).

The new feature is to have a new option to mythtranscode: --cleancut. When this option is invoked, each cut is performed in two stages: first the player seeks (as is the normal case), but not for the entire cut; then the cut is completed by discarding data.

It's a shame to have to add further complication to mythtranscode's synchronisation mechanism, but I have at least managed to encompass the new behaviour in a subsiduary class. In tests, the feature seems to work very well. I have added the feature only for fifodir mode so far.

I originally attempted to implement this by performing no seeks and only discarding data. That failed because strangely mythplayer associates frame numbers with actual frame data differently depending on whether the point is reached via an initial seek or by decoding from the beggining. I guess this is a bug. It usually causes no visible problems, because the setting of cut points and the use of them is both performed while seeking. I'd guess though that advert recognition decodes the entirety of the stream and hence will be out by about a second. One would blaim the recognition algorithm for this and not realise it was a player bug.

Change History (7)

comment:1 Changed 13 years ago by mythtv@…

If for any reason this patch is unacceptable in it's current state, I am happy to do more work on it.

comment:2 Changed 12 years ago by beirdo

Owner: set to beirdo
Status: newassigned

comment:3 Changed 12 years ago by Github

Milestone: unknown0.25
Resolution: fixed
Status: assignedclosed

Merge branch 'glidos-master'

Adds --cleancut parameter to mythtranscode.

Closes #10008

Merged in changes from git://github.com/Glidos/mythtv.git master branch.

Branch: master Changeset: 2eb5723426ed1cd6f3856f33bb8ebef98e385200

comment:4 Changed 12 years ago by danielk

Resolution: fixed
Status: closednew

This appears to have introduced two new complaints in the cppcheck report.

comment:5 Changed 12 years ago by lihamakaroonilaatikko@…

Hopefully someone will backport this to 0.24-fixes since the problem exists also in 0.24.2.

comment:6 Changed 12 years ago by beirdo

Resolution: Fixed
Status: newclosed

I don't consider that a reason to keep this ticket open. Feel free to open a new ticket for subsequent cleanup.

comment:7 Changed 12 years ago by Github

Squash cppcheck reports in new transcode code

Refs #10008

Branch: master Changeset: 5574952b5f5688ec7e3b60b9c68d305d38b64c75

Note: See TracTickets for help on using tickets.