Opened 3 years ago

Closed 2 years ago

Last modified 18 months ago

#12990 closed Patch - Bug Fix (Won't Fix)

Playback jitter deinterlaced media

Reported by: blm-ubunet@… Owned by: Peter Bennett
Priority: minor Milestone: 29.0
Component: MythTV - Video Playback Version: Master Head
Severity: medium Keywords: jitter playback interlaced
Cc: Ticket locked: no

Description

High jitter for playback of double framerate deinterlaced video media. The frame delay is not calculated correctly for double frame rate deinterlaced playback so the AVSync oscillates wildly.

See Ticket #11246 https://code.mythtv.org/trac/ticket/11246 for history. The patch from 11246 worked because typically the monitor refreshrate is >= double frame rate (field --> frame) of deinterlaced video. I think the actual fault was same as described by this ticket.

New patch attached, Have tested (eyeballs on screen) with display refreshrates of 50 & 60Hz & range of international video samples of progressive & interlaced from 24p to 120p. When display rate == video rate, playback is jitter free (prog & interlaced). Viewing i50 on 60Hz display is pretty good even for watching motorsport.

Attachments (3)

mythtv-gitdiff-mythplayer-cpp-20170206.txt (4.9 KB) - added by blm-ubunet@… 3 years ago.
git diff my_branch vs master for mythplayer.cpp
git-diff-master-mythplayer-20170807.txt (15.6 KB) - added by blm-ubunet@… 2 years ago.
git diff patch for lib/mythtv/mythplayer
git-diff-master-mythplayer-20170807.patch (15.6 KB) - added by Peter Bennett 2 years ago.
File renamed as .patch so it can be viewed more easily

Download all attachments as: .zip

Change History (10)

Changed 3 years ago by blm-ubunet@…

git diff my_branch vs master for mythplayer.cpp

comment:1 Changed 2 years ago by blm-ubunet@…

I believe the problem is in frame/field timing. Attached patch reworks the AVSync calculations & (attempts) allows for frame or field drop/repeats to resync video. Last field repeats are still going to upset the advanced deinterlacer.

Changed 2 years ago by blm-ubunet@…

git diff patch for lib/mythtv/mythplayer

Changed 2 years ago by Peter Bennett

File renamed as .patch so it can be viewed more easily

comment:2 Changed 2 years ago by Peter Bennett

It is helpful if you name your patches with .patch extension. That way the web site displays a much better view of the proposed change

comment:3 Changed 2 years ago by Peter Bennett

Owner: changed from JYA to Peter Bennett
Status: newassigned

comment:4 Changed 2 years ago by Peter Bennett

Status: assignedinfoneeded

I tried watching a couple of interlaced recordings with and without the latest (20170807) patch. I cannot see any improvement. Please you can give some guidelines on what to look for. Below is the jitterometer log from playing two recordings with and without the patch. This is a monitor with 60 Hz refresh.

https://pastebin.com/QyZiAQws

comment:5 Changed 2 years ago by blm-ubunet@…

The biggest improvement is with frame-refresh rate mismatch.

But that's not a likely playback problem any more except that right now mythtv video refresh rate selection with nvidia driver is broken. (Some kind soul has provided a patch for this.)

Other thing patch tried to do was better frame/field repeat/slip for incorrect video modelines. The open source 'cvt' calculated 50Hz modelines for my needs caused frame error every 15mins. A quick spreadsheet analysis shows most modelines are (unnecessarily) incorrect.

There are better modelines for 4K digital displays (including RVB) that open source calculators do not generate but these are non-free.

I submitted this patch about time when nvidia VDPAU advanced de-interlacing was broken for all 900 & 1000 series video cards (actually never worked). https://devtalk.nvidia.com/default/topic/985301/linux/gtx-1050ti-vdpau-deinterlacers-/

So not using 2x advanced DI may have made problem more obvious. Maybe can only see jitter problem with actual monitor & very fast video processing. Plausible that modern TVs cover up (motion-flow) bad input. I eyeball the display with de-interlacing video test tracks or MotoGP.

An unresolved issue with this patch is that the sync offset converges differently (better) after pause or rewind.

In error, hidden in the patch was a better pause (& field swap for VDPAU). My intention was to get paused deinterlaced frame to be full resolution instead of half. But that's not possible without changing the output frame buffer & OSD overlay methods or breaking OSD! I wanted full resolution DI pause so could take photos of the VDPAU DI display corruption.

MythTV pauses playback by racing to consume all decoded frames & then jiggles/shakes itself back to right frame when playback resumes. Looks tacky/terrible. Pause is actually re-rendering same field (or frame for prog. scan) repeatedly so the OSD overlays work.

Thanks for looking & trying the patch. I'm still using it & always will.

comment:6 Changed 2 years ago by Peter Bennett

Resolution: Won't Fix
Status: infoneededclosed

I agree that much is wrong with the player logic. However I am closing this ticket as it seems that it does not seem to give much improvement, and may impact other users in unknown ways.

comment:7 Changed 18 months ago by Peter Bennett

Owner: changed from Peter Bennett to Peter Bennett
Note: See TracTickets for help on using tickets.