[Fixed] svn6837 - MKV encoding, missing field "default frame duration" in video track

Archive of historical bug reports.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
JimKnopf
Novice
Posts: 53
Joined: Wed Jan 29, 2014 11:51 am

[Fixed] svn6837 - MKV encoding, missing field "default frame duration" in video track

Post by JimKnopf »

svn6837 on Windows 7 64 Home Premium
test material: BD Lucy (2014)

Problem(s):
1. In the past (previous nightlies and stable release 10.0) the "Framerate(FPS)" setting "Same as Source" always produced with BD material an MKV with constant frame rate mode, correct frame rate and a correct setting of the frame duration in the Video track header (41666666 nanoseconds/frame with 24 fps material, 41708333 nanoseconds with 24000/1001 fps material). Now, "Same as Source" produces an MKV with either variable or constant frame rate depending on the switch below the FrameRate (FPS) in the GUI, Video tab. Isn't BD material always constant so "Same as Source" should always create constant frame rate with this source?
2. With this nightly and some previous versions, the video track header field "Frame Duration" (in mkvmerge GUI Header Editor it's called "Default Duration") is not set anymore.

Media players like the WD TV Live and the new WD TV are not able to play such MKVs without showing (micro) judders every few seconds if this video track header field is not set at all.

Attached a log of an ecoding test run and the MediaInfo output BUT in the resulting MKV the frame duration field is empty in the video track header instead of showing the correct value 41708333 there:

Code: Select all

HandBrake svn6837 (Nightly Build) - 64bit Version
OS: Microsoft Windows NT 6.1.7601 Service Pack 1 - 64bit
CPU: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
Ram: 12227 MB, 
GPU Information:
  NVIDIA GeForce GTX 680 - 9.18.13.4725
Screen: 1920x1080
Temp Dir: C:\Users\Holger\AppData\Local\Temp\
Install Dir: C:\Program Files\Handbrake
Data Dir: C:\Users\Holger\AppData\Roaming\HandBrake\HandBrake\0.0.0.6837

-------------------------------------------


# Scanning title for encoding ... 
[08:19:12] CPU: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
[08:19:12]  - Intel microarchitecture Ivy Bridge
[08:19:12]  - logical processor count: 8
[08:19:12] OpenCL device #1: NVIDIA Corporation GeForce GTX 680
[08:19:12]  - OpenCL version: 1.1 CUDA
[08:19:12]  - driver version: 347.25
[08:19:12]  - device type:    GPU
[08:19:12]  - supported:      no
[08:19:12] Intel Quick Sync Video support: no
[08:19:12] hb_scan: path=Y:\purgeme\Filme\verified_forced_subtitle\LUCY_UPB1, title_index=33
[08:19:12] scan: BD has 34 title(s)
[08:19:12] bd: scanning title 33
[08:19:12] bd: playlist 00800.MPLS
[08:19:12] bd: duration is 01:29:20 (5360396 ms)
[08:19:12] bd: video id=0x1011, stream type=H.264, format 1080p
[08:19:12] bd: aspect = 16:9
[08:19:12] bd: audio id=0x1100, lang=Japanese (DTS), 3cc=jpn
[08:19:12] bd: audio id=0x711101, lang=English (DTS), 3cc=eng
[08:19:12] bd: audio id=0x1101, lang=English (DTS-HD MA), 3cc=eng
[08:19:12] bd: audio id=0x1102, lang=Italiano (DTS), 3cc=ita
[08:19:12] bd: audio id=0x1103, lang=Deutsch (DTS), 3cc=deu
[08:19:12] bd: audio id=0x1104, lang=Espanol (DTS), 3cc=spa
[08:19:12] bd: audio id=0x1105, lang=Hindi (DTS), 3cc=hin
[08:19:12] bd: audio id=0x1106, lang=English (AC3), 3cc=eng
[08:19:12] bd: subtitle id=0x1200, lang=Japanese, 3cc=jpn
[08:19:12] bd: subtitle id=0x1201, lang=English, 3cc=eng
[08:19:12] bd: subtitle id=0x1202, lang=Italiano, 3cc=ita
[08:19:12] bd: subtitle id=0x1203, lang=Deutsch, 3cc=deu
[08:19:12] bd: subtitle id=0x1204, lang=Espanol, 3cc=spa
[08:19:12] bd: subtitle id=0x1205, lang=Hindi, 3cc=hin
[08:19:12] bd: subtitle id=0x1206, lang=Portugues, 3cc=por
[08:19:12] bd: subtitle id=0x1207, lang=Dansk, 3cc=dan
[08:19:12] bd: subtitle id=0x1208, lang=Suomi, 3cc=fin
[08:19:12] bd: subtitle id=0x1209, lang=Islenska, 3cc=isl
[08:19:12] bd: subtitle id=0x120a, lang=Norsk, 3cc=nor
[08:19:12] bd: subtitle id=0x120b, lang=Svenska, 3cc=swe
[08:19:12] bd: subtitle id=0x120c, lang=Arabic, 3cc=ara
[08:19:12] bd: subtitle id=0x120d, lang=Japanese, 3cc=jpn
[08:19:12] bd: subtitle id=0x120e, lang=English, 3cc=eng
[08:19:12] bd: subtitle id=0x120f, lang=Italiano, 3cc=ita
[08:19:12] bd: subtitle id=0x1210, lang=Deutsch, 3cc=deu
[08:19:12] bd: subtitle id=0x1211, lang=Espanol, 3cc=spa
[08:19:12] bd: subtitle id=0x1212, lang=Hindi, 3cc=hin
[08:19:12] bd: chap 1 packet=960, 326367 ms
[08:19:12] bd: chap 2 packet=1660856640, 191900 ms
[08:19:12] bd: chap 3 packet=2570323200, 427635 ms
[08:19:12] bd: chap 4 packet=4521301632, 350391 ms
[08:19:12] bd: chap 5 packet=6148910784, 269102 ms
[08:19:12] bd: chap 6 packet=7518607680, 262136 ms
[08:19:12] bd: chap 7 packet=8751029952, 428719 ms
[08:19:12] bd: chap 8 packet=10832230656, 247205 ms
[08:19:12] bd: chap 9 packet=12075456000, 349098 ms
[08:19:12] bd: chap 10 packet=13853680896, 158158 ms
[08:19:12] bd: chap 11 packet=14628191808, 321779 ms
[08:19:12] bd: chap 12 packet=16261263360, 243576 ms
[08:19:12] bd: chap 13 packet=17458129920, 152026 ms
[08:19:12] bd: chap 14 packet=18237105024, 163246 ms
[08:19:12] bd: chap 15 packet=19081076736, 142684 ms
[08:19:12] bd: chap 16 packet=19790174400, 161786 ms
[08:19:12] bd: chap 17 packet=20564247936, 150316 ms
[08:19:12] bd: chap 18 packet=21290060352, 384467 ms
[08:19:12] bd: chap 19 packet=23249442240, 220970 ms
[08:19:12] bd: chap 20 packet=24388183296, 408574 ms
[08:19:12] bd: chap 21 packet=26082730560, 250 ms
[08:19:12] bd: title 33 has 21 chapters
[08:19:12] scan: decoding previews for title 33
[08:19:12] scan: title angle(s) 1
[08:19:12] scan: audio 0x1106: ac3, rate=48000Hz, bitrate=192000 English (AC3) (2.0 ch) (Dolby Surround)
[08:19:12] scan: audio 0x711101: dca, rate=48000Hz, bitrate=1536000 English (DTS) (5.1 ch)
[08:19:12] scan: audio 0x1101: dca, rate=48000Hz, bitrate=1536000 English (DTS-HD MA) (5.1 ch)
[08:19:12] scan: audio 0x1100: dca, rate=48000Hz, bitrate=768000 Japanese (DTS) (5.1 ch)
[08:19:12] scan: audio 0x1102: dca, rate=48000Hz, bitrate=768000 Italiano (DTS) (5.1 ch)
[08:19:12] scan: audio 0x1103: dca, rate=48000Hz, bitrate=768000 Deutsch (DTS) (5.1 ch)
[08:19:12] scan: audio 0x1104: dca, rate=48000Hz, bitrate=768000 Espanol (DTS) (5.1 ch)
[08:19:12] scan: audio 0x1105: dca, rate=48000Hz, bitrate=768000 Hindi (DTS) (5.1 ch)
[08:19:20] scan: 60 previews, 1920x1080, 23.976 fps, autocrop = 138/138/0/0, aspect 16:9, PAR 1:1
[08:19:20] stream: 9 good frames, 0 errors (0%)
[08:19:20] libhb: scan thread found 1 valid title(s)
# Scan Completed. Setting up the job for encoding ...
# Starting Encode ...
[08:19:20] 2 job(s) to process
[08:19:20] starting job
[08:19:20] sync: expecting 7824 video frames
[08:19:20] work: only 1 chapter, disabling chapter markers
[08:19:20] job configuration:
[08:19:20]  * source
[08:19:20]    + Y:\purgeme\Filme\verified_forced_subtitle\LUCY_UPB1
[08:19:20]    + title 33, chapter(s) 1 to 1
[08:19:20]  * destination
[08:19:20]    + Y:\purgeme\Filme\Lucy 6837 same as source const.mkv
[08:19:20]    + container: Matroska (libavformat)
[08:19:20]  * video track
[08:19:20]    + decoder: h264
[08:19:20]      + bitrate 200 kbps
[08:19:20]    + filters
[08:19:20]      + Framerate Shaper (1:27000000:1126125)
[08:19:20]        + frame rate: 23.976 fps -> constant 23.976 fps
[08:19:20]      + Crop and Scale (1920:804:138:138:0:0)
[08:19:20]        + source: 1920 * 1080, crop (138/138/0/0): 1920 * 804, scale: 1920 * 804
[08:19:20]    + Output geometry
[08:19:20]      + storage dimensions: 1920 x 804
[08:19:20]      + pixel aspect ratio: 1 : 1
[08:19:20]      + display dimensions: 1920 x 804
[08:19:20]  * Foreign Audio Search: Passthrough
[08:19:20]    + subtitle, Deutsch (track 3, id 0x1203) Picture [PGS]
[08:19:20]    + subtitle, Deutsch (track 16, id 0x1210) Picture [PGS]
[08:19:30] reader: end of chapter 1 (media 1) reached at media chapter 2
[08:19:30] reader: done. 2 scr changes
[08:19:30] work: average encoding speed for job is 0.000000 fps
[08:19:30] render: 0 frames output, 0 dropped and 0 duped for CFR/PFR
[08:19:30] render: lost time: 0 (0 frames)
[08:19:30] render: gained time: 0 (0 frames) (0 not accounted for)
[08:19:30] stream: 7826 good frames, 0 errors (0%)
[08:19:30] Subtitle track 3 (id 0x1203) 'Deutsch': 84 hits (0 forced)
[08:19:30] Subtitle track 16 (id 0x1210) 'Deutsch': 0 hits (0 forced)
[08:19:30] No candidate detected during subtitle scan
[08:19:30] starting job
[08:19:30] sync: expecting 7824 video frames
[08:19:30] work: only 1 chapter, disabling chapter markers
[08:19:30] job configuration:
[08:19:30]  * source
[08:19:30]    + Y:\purgeme\Filme\verified_forced_subtitle\LUCY_UPB1
[08:19:30]    + title 33, chapter(s) 1 to 1
[08:19:30]  * destination
[08:19:30]    + Y:\purgeme\Filme\Lucy 6837 same as source const.mkv
[08:19:30]    + container: Matroska (libavformat)
[08:19:30]  * video track
[08:19:30]    + decoder: h264
[08:19:30]      + bitrate 200 kbps
[08:19:30]    + filters
[08:19:30]      + Framerate Shaper (1:27000000:1126125)
[08:19:30]        + frame rate: 23.976 fps -> constant 23.976 fps
[08:19:30]      + Crop and Scale (1920:804:138:138:0:0)
[08:19:30]        + source: 1920 * 1080, crop (138/138/0/0): 1920 * 804, scale: 1920 * 804
[08:19:30]    + Output geometry
[08:19:30]      + storage dimensions: 1920 x 804
[08:19:30]      + pixel aspect ratio: 1 : 1
[08:19:30]      + display dimensions: 1920 x 804
[08:19:30]    + encoder: H.264 (libx264)
[08:19:30]      + preset:  medium
[08:19:30]      + profile: high
[08:19:30]      + level:   4.1
[08:19:30]      + quality: 20.00 (RF)
[08:19:30]  * subtitle track 1, Deutsch (track 3, id 0x1203) Picture [PGS] -> Passthrough
[08:19:30]  * subtitle track 2, Deutsch (track 16, id 0x1210) Picture [PGS] -> Passthrough
[08:19:30]  * subtitle track 3, English (track 1, id 0x1201) Picture [PGS] -> Passthrough
[08:19:30]  * subtitle track 4, English (track 14, id 0x120e) Picture [PGS] -> Passthrough
[08:19:30]  * audio track 1
[08:19:30]    + decoder: Deutsch (DTS) (5.1 ch) (track 5, id 0x1103)
[08:19:30]      + bitrate: 768 kbps, samplerate: 48000 Hz
[08:19:30]    + DTS Passthru
[08:19:30]  * audio track 2
[08:19:30]    + decoder: English (DTS) (5.1 ch) (track 2, id 0x711101)
[08:19:30]      + bitrate: 1536 kbps, samplerate: 48000 Hz
[08:19:30]    + DTS Passthru
[08:19:30] encx264: min-keyint: 24, keyint: 240
[08:19:30] encx264: encoding at constant RF 20.000000
[08:19:30] encx264: unparsed options: level=4.1:vbv-bufsize=78125:vbv-maxrate=62500
x264 [info]: using SAR=1/1
[08:19:30] reader: first SCR 1044806 id 0x1011 DTS 1044806
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x264 [info]: profile High, level 4.1
[08:19:30] h264: "Chapter 1" (1) at frame 0 time 3754
[08:19:30] sync: first pts is 3754
[08:23:49] reader: end of chapter 1 (media 1) reached at media chapter 2
[08:23:49] reader: done. 2 scr changes
[08:23:55] work: average encoding speed for job is 30.045996 fps
[08:23:55] sync: got 7825 frames, 7824 expected
[08:23:55] render: 7825 frames output, 0 dropped and 0 duped for CFR/PFR
[08:23:55] render: lost time: 0 (0 frames)
[08:23:55] render: gained time: 0 (0 frames) (0 not accounted for)
[08:23:55] h264-decoder done: 7825 frames, 0 decoder errors, 0 drops
x264 [info]: frame I:139   Avg QP:17.91  size:153234
x264 [info]: frame P:4137  Avg QP:20.43  size: 39777
x264 [info]: frame B:3549  Avg QP:20.87  size: 11163
x264 [info]: consecutive B-frames: 26.1% 33.5% 20.3% 20.1%
x264 [info]: mb I  I16..4: 12.8% 74.0% 13.2%
x264 [info]: mb P  I16..4:  2.3% 10.6%  1.4%  P16..4: 41.7% 15.8%  8.5%  0.0%  0.0%    skip:19.7%
x264 [info]: mb B  I16..4:  0.1%  0.7%  0.2%  B16..8: 33.9%  4.1%  1.0%  direct: 2.6%  skip:57.4%  L0:38.1% L1:51.3% BI:10.5%
x264 [info]: 8x8 transform intra:73.8% inter:78.4%
x264 [info]: coded y,uvDC,uvAC intra: 69.7% 83.7% 51.1% inter: 22.9% 30.4% 2.6%
x264 [info]: i16 v,h,dc,p: 33% 16%  6% 45%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 17% 15%  6%  8%  9%  8%  8%  8%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 17% 10%  5%  9%  9%  8%  6%  5%
x264 [info]: i8c dc,h,v,p: 50% 20% 21% 10%
x264 [info]: Weighted P-Frames: Y:14.8% UV:11.5%
x264 [info]: ref P L0: 64.0% 15.6% 14.2%  5.8%  0.5%
x264 [info]: ref B L0: 88.6% 10.4%  0.9%
x264 [info]: ref B L1: 97.1%  2.9%
x264 [info]: kb/s:5526.90
[08:23:55] dca-decoder done: 0 frames, 0 decoder errors, 0 drops
[08:23:55] dca-decoder done: 0 frames, 0 decoder errors, 0 drops
[08:23:55] mux: track 0, 7825 frames, 225471103 bytes, 5526.80 kbps, fifo 1024
[08:23:55] mux: track 1, 30550 frames, 31283200 bytes, 766.82 kbps, fifo 4096
[08:23:55] mux: track 2, 30529 frames, 61424348 bytes, 1505.65 kbps, fifo 4096
[08:23:55] mux: track 3, 168 frames, 1739507 bytes, 42.64 kbps, fifo 32
[08:23:55] mux: track 4, 0 frames, 0 bytes, 0.00 kbps, fifo 8
[08:23:55] mux: track 5, 186 frames, 2058132 bytes, 50.45 kbps, fifo 32
[08:23:55] mux: track 6, 0 frames, 0 bytes, 0.00 kbps, fifo 8
[08:23:55] stream: 7826 good frames, 0 errors (0%)
[08:23:55] libhb: work result = 0
# Encode Completed ...

Code: Select all

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 5mn 26s
Bit rate                                 : 5 468 Kbps
Width                                    : 1 920 pixels
Height                                   : 804 pixels
Display aspect ratio                     : 2.40:1
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.148
Stream size                              : 213 MiB (69%)
Writing library                          : x264 core 142 r2479 dd79a61
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00: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=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=62500 / vbv_bufsize=78125 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Default                                  : Yes
Forced                                   : No
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Color range                              : Limited
Deleted User 11865

Re: [Not a bug] svn6837 - MKV encoding, missing field "default frame duration" in video track

Post by Deleted User 11865 »

DefaultDuration is not a mandatory element for Matroska files.

As for media players that don't like this, you can always remux your files with mkvmerge before feeding the file to said players.
JimKnopf
Novice
Posts: 53
Joined: Wed Jan 29, 2014 11:51 am

Re: [Not a bug] svn6837 - MKV encoding, missing field "default frame duration" in video track

Post by JimKnopf »

Understood, so, you're taking away this function which has worked fine since that last 10.0 release and expect the end users to fix the handbrake output by other tools to make the MKVs working well again on the most popular media players.

In the terms of Matroska the DEFAULTDURATION field is not mandatory ... but the same time it is recommendet to write this element, see
http://www.matroska.org/files/matroska.pdf chapter "Tracks", page 20.

I could accept your point of view if popular media players would have an issue when this field is set ... but the opposite is the case in real since not anyone has grumbled in the past the he/she has a problem finding the correct value in this element.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5723
Joined: Sat Feb 09, 2008 7:21 pm

Re: [Not a bug] svn6837 - MKV encoding, missing field "default frame duration" in video track

Post by JohnAStebbins »

We didn't "take it away". We updated the library that does muxing, and there was an unexpected API change. I'll fix it momentarily. Thanks for pointing out the change in behavior.
mduell
Veteran User
Posts: 8198
Joined: Sat Apr 21, 2007 8:54 pm

Re: svn6837 - MKV encoding, missing field "default frame duration" in video track

Post by mduell »

JimKnopf wrote:Media players like the WD TV Live and the new WD TV are not able to play such MKVs without showing (micro) judders every few seconds if this video track header field is not set at all.
JimKnopf wrote:In the terms of Matroska the DEFAULTDURATION field is not mandatory
Why not use a format your playback device actually supports?

Or buy a playback device that supports the format you want to/have to use... :idea:
JimKnopf wrote:Understood, so, you're taking away this function which has worked fine since that last 10.0 release and expect the end users to fix the handbrake output by other tools to make the MKVs working well again on the most popular media players.
Yes, this change was specifically aimed at ending compatibility with broken playback devices.

Er, no, it was an unintentional change with a update in an upstream library. But flame on man.

Fortunately John is going to maintain yet another workaround for broken playback devices.
JimKnopf
Novice
Posts: 53
Joined: Wed Jan 29, 2014 11:51 am

Re: svn6837 - MKV encoding, missing field "default frame duration" in video track

Post by JimKnopf »

@JohnAStebbins: Thx a lot! Really appreciate the excellent work from you and your team.
JimKnopf
Novice
Posts: 53
Joined: Wed Jan 29, 2014 11:51 am

Re: svn6837 - MKV encoding, missing field "default frame duration" in video track

Post by JimKnopf »

@mduell: Coming back to your idea for a new playback device. Anything you can suggest with full hd 24p and 24000/1001p Support, DTS-HD MASTER and Dolby TrueHD passthrough via HDMI and a family friendly GUI?

I'm always open for good ideas.
JimKnopf
Novice
Posts: 53
Joined: Wed Jan 29, 2014 11:51 am

Re: svn6837 - MKV encoding, missing field "default frame duration" in video track

Post by JimKnopf »

Matroska video track element DEFAULTDURATION is set correctly with svn6858, again. Tested with 24p and 24000/1001p material.
Post Reply