﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
12047	mythplayer picks the wrong fps for 1080i matroska, degrading to 1xHW deint	angela.schmid@…	Karl Egly	"mythplayer chooses to use the avg_fps (50) instead of the codec_fps (25) for 1080i matroska movies, therefor mythplayer decides to degrade deinterlacing to max 1xHW.

The problem is most clearly with a movie with extreme horizontal panning. I have a movie which I want to archive in mkv (lossless_cut) with a view on a large Chinese dragon wall.

{{{
Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.0
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Format settings, GOP                     : M=4, N=28
Codec ID                                 : V_MPEG4/ISO/AVC
Bit rate                                 : 2 884 Kbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Original frame rate                      : 25.000 fps
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Bottom Field First
}}}

{{{
CoreContext avformatdecoder.cpp:1247 (normalized_fps) - AFD: Selected FPS is 50 (avg 50 codec 25 container 1000 estimated 50)
}}}

Setting primary deinterlacing option (2xHW):
{{{
CoreContext videodisplayprofile.cpp:354 (GetFilteredDeint) - VDP: GetFilteredDeint() : vdpau -> 'vdpaubasicdoublerate'
}}}

Degrade to fallback deinterlacing option (max 1xHW):

{{{
CoreContext mythplayer.cpp:2384 (VideoStart) - Player(0): Video sync method can't support double framerate (refresh rate too low for 2x deint)
CoreContext videodisplayprofile.cpp:354 (GetFilteredDeint) - VDP: GetFilteredDeint(vdpauadvanced) : vdpau -> 'vdpauadvanced'
}}}

Mythplayer should use the codec_fps, which is correct for 1080i.

The following dirty patch fixes the problem:
{{{
diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
index 3a42b40..6698484 100644
--- a/mythtv/libs/libmythtv/avformatdecoder.cpp
+++ b/mythtv/libs/libmythtv/avformatdecoder.cpp
@@ -1221,7 +1221,11 @@ float AvFormatDecoder::normalized_fps(AVStream *stream, AVCodecContext *enc)

     // matroska demuxer sets the default_duration to avg_frame_rate
     // mov,mp4,m4a,3gp,3g2,mj2 demuxer sets avg_frame_rate
-    if ((QString(ic->iformat->name).contains(""matroska"") ||
+    if ((QString(ic->iformat->name).contains(""matroska"")) &&
+        container_fps < 121.0f && container_fps > 3.0f)
+        fps = container_fps;
+    else
+    if ((QString(ic->iformat->name).contains(""xmatroska"") ||
         QString(ic->iformat->name).contains(""mov"")) &&
         avg_fps < 121.0f && avg_fps > 3.0f)
         fps = avg_fps;
}}}
"	Patch - Bug Fix	closed	major		MythTV - Video Playback	Master Head	high	Abandoned	deinterlace mkv 1080i		0
