Video file FPS changes 5 seconds after start?
#1
This only seems to happen with a few video files, so I'm sure it's more related to the videos and not kodi itself, but I can't find anything special about the video files themselves:

Code:
22:04:04 T:139735554779200  NOTICE: Starting Kodi (15.2 Git:02e7013). Platform: Linux x86 64-bit
22:04:04 T:139735554779200  NOTICE: Using Release Kodi x64 build
22:04:04 T:139735554779200  NOTICE: Kodi compiled Nov  1 2015 by GCC 5.2.1 for Linux x86 64-bit version 4.2.3 (262659)
22:04:04 T:139735554779200  NOTICE: Running on Ubuntu 15.10, kernel: Linux x86 64-bit version 4.2.0-040200-generic
22:04:04 T:139735554779200  NOTICE: FFmpeg statically linked, version: 2.6.4-kodi-2.6.4-Isengard
22:04:04 T:139735554779200  NOTICE: Host CPU: Intel(R) Celeron(R) CPU N2820 @ 2.13GHz, 2 cores available
edit: removed, see log below

As you can see it detects the video as 23.809254 and sets the display refresh rate to 60, but 6 seconds in to playing it re-detects the video as 23.976 and sets the display to that.

mediainfo however reports the video as 23.976 with constant frame rate:

Code:
$ mediainfo \[HorribleSubs\]\ Fairy\ Tail\ -\ 170\ \[720p\].mkv
General
Unique ID                                : 229307644475671745311991405288932465525 (0xAC830BBFEC3E0BFE8D3FE2633C5F5B75)
Complete name                            : [HorribleSubs] Fairy Tail - 170 [720p].mkv
Format                                   : Matroska
Format version                           : Version 2
File size                                : 332 MiB
Duration                                 : 24mn 24s
Overall bit rate                         : 1 903 Kbps
Encoded date                             : UTC 2013-02-23 03:05:07
Writing application                      : mkvmerge v5.2.0 ('I can't explain') built on Dec 18 2011 18:12:03
Writing library                          : libebml v1.2.3 + libmatroska v1.3.0
Attachment                               : Yes

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 6 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 24mn 24s
Nominal bit rate                         : 1 776 Kbps
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.080
Writing library                          : x264 core 120 r2120 0c7dab9
Encoding settings                        : cabac=1 / ref=6 / deblock=1:1:1 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=0.40:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=2pass / mbtree=1 / bitrate=1776 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=3552 / vbv_bufsize=8880 / nal_hrd=none / ip_ratio=1.40 / aq=1:0.60
Default                                  : Yes
Forced                                   : Yes

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : A_AAC
Duration                                 : 24mn 24s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 KHz
Compression mode                         : Lossy
Default                                  : Yes
Forced                                   : Yes

Text
ID                                       : 3
Format                                   : ASS
Codec ID                                 : S_TEXT/ASS
Codec ID/Info                            : Advanced Sub Station Alpha
Compression mode                         : Lossless
Default                                  : Yes
Forced                                   : Yes


Any idea why kodi might be detecting the FPS wrong on this video file? or something else I could check on the video file to see why kodi might think it's 23.809?


edit: actually I've figured it out, it appears to be due to the MKV muxing:
Code:
$ mkvinfo \[HorribleSubs\]\ Fairy\ Tail\ -\ 170\ \[720p\].mkv
+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ EBML maximum ID length: 4
|+ EBML maximum size length: 8
|+ Doc type: matroska
|+ Doc type version: 2
|+ Doc type read version: 2
+ Segment, size 348325345
|+ Seek head (subentries will be skipped)
|+ EbmlVoid (size: 4029)
|+ Segment information
| + Timecode scale: 1000000
| + Muxing application: libebml v1.2.3 + libmatroska v1.3.0
| + Writing application: mkvmerge v5.2.0 ('I can't explain') built on Dec 18 2011 18:12:03
| + Duration: 1464.575s (00:24:24.575)
| + Date: Sat Feb 23 03:05:07 2013 UTC
| + Segment UID: 0xac 0x83 0x0b 0xbf 0xec 0x3e 0x0b 0xfe 0x8d 0x3f 0xe2 0x63 0x3c 0x5f 0x5b 0x75
|+ Segment tracks
| + A track
|  + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
|  + Track UID: 2455971007
|  + Track type: video
|  + Forced flag: 1
|  + Lacing flag: 0
|  + MinCache: 1
|  + Codec ID: V_MPEG4/ISO/AVC
|  + CodecPrivate, length 40 (h.264 profile: High @L4.0)
|  + Default duration: 42.000ms (23.810 frames/fields per second for a video track)
|  + Language: und
|  + Video track
|   + Pixel width: 1280
|   + Pixel height: 720
|   + Display width: 1280
|   + Display height: 720
| + A track
|  + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
|  + Track UID: 2147870086
|  + Track type: audio
|  + Forced flag: 1
|  + Codec ID: A_AAC
|  + CodecPrivate, length 2
|  + Default duration: 23.220ms (43.066 frames/fields per second for a video track)
|  + Language: und
|  + Audio track
|   + Sampling frequency: 44100
|   + Channels: 2
| + A track
|  + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
|  + Track UID: 573666743
|  + Track type: subtitles
|  + Forced flag: 1
|  + Lacing flag: 0
|  + Codec ID: S_TEXT/ASS
|  + CodecPrivate, length 1073
|  + Language: und
|+ EbmlVoid (size: 1102)
|+ Attachments
| + Attached
|  + File name: BAARS___.TTF
|  + Mime type: application/x-truetype-font
|  + File data, size: 47864
|  + File UID: 2669676979
|+ Cluster
Reply
#2
(2016-02-13, 14:29)mrsix Wrote: Any idea why kodi might be detecting the FPS wrong on this video file? or something else I could check on the video file to see why kodi might think it's 23.809?

Most likely because timestamps of the video are messy or it is variable refresh rate. If you turned on debug logging we would see more. Never post log snippets directly into the forum. Please use pastebin for complete logs.
Reply
#3
Out of curiosity I remuxed the file with mkvmerge and set the video frame manually to 29.976 and it worked perfectly without any changes to the actual video stream, and didn't cause any sort of frame drop/sync issues, so it definitely is the MKV muxing that causes it. If you want to see what it (the original unfixed file) does with debug on however it does this:

http://pastebin.com/E3EtS8Nu

Based on that it seems CPullupCorrection / CalcFrameRate is correcting it, just not sure why it happens 5 seconds after the video starts, seems like it would make more sense to do it right away?
Reply
#4
I don't see the mentioned 23.809 in this log
Reply
#5
It's in the ffmpeg parsing:

Code:
06:47:55 T:139733850113792    INFO: ffmpeg[7F16527FC700]:     Stream #0:0: Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 23.81 fps, 23.81 tbr, 1k tbn, 47.95 tbc (default) (forced)

Rounded to 23.81 in that instance.

And lower where it sets the display:

Code:
06:47:55 T:139733657147136  NOTICE:  fps: 23.809524, pwidth: 1280, pheight: 720, dwidth: 1280, dheight: 720
06:47:55 T:139733657147136   DEBUG: OutputPicture - change configuration. 1280x720. framerate: 23.81. format: VAAPI
Reply

Logout Mark Read Team Forum Stats Members Help
Video file FPS changes 5 seconds after start?0