This project has moved and is read-only. For the latest updates, please go here.

MKV x264, x265 and skipping in WMC

Feb 27, 2016 at 9:31 PM
Edited Feb 27, 2016 at 9:38 PM
Hi, I have been messing with MCEBuddy for the past couple of weeks (2.4.3), trying to get it to create output that works just as well as my current Ripbot264 and handbrake-encoded Bluray and DVD rip collection. In Emby for WMC I am able to skip normally in every video I have encoded this way, but nothing that I've gotten MCEBuddy to put out seems to work for this.

I noticed that when playing my existing rips in WMC, that it is actually using LAV splitter, but when playing back the output from MCEBuddy it seems to be using the built-in stuff.

I have been focused on trying to compare the files I'm getting using MediaInfo to try to make them as similar as possible. I've created a custom profile for encoding to try to begin to approach similar settings to what I had before, and I figured out that the hardware encoding is not for me (incredibly blocky output), so I'm doing all of this testing at a snail's pace.

I have tried changing out the HandbrakeCLI with one that produced an encode from a DVD source that works, changing out eac3to with the version from Ripbot I'm using (v3.31) (and these are kind of last-resort things).

Does anyone know what parameter(s) I need to alter to be able to encode the .wtv's into MKV?

Here is the mediainfo output for a working file (DVD rip using handbrake through its GUI):
Format                                   : Matroska
Format version                           : Version 2
File size                                : 642 MiB
Duration                                 : 1h 38mn
Overall bit rate                         : 915 Kbps
Encoded date                             : UTC 2016-02-24T01:17:18Z
Writing application                      : HandBrake 0.10.5 2016021100
Writing library                          : Lavf55.12.0 / Lavf55.12.0

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L4
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 5 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Bit rate                                 : 448 Kbps
Width                                    : 720 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 2.35:1
Original display aspect ratio            : 2.40:1
Frame rate mode                          : Variable
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : x264 core 142 r2479 dd79a61
Encoding settings                        : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x1:0x111 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / 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=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=20000 / vbv_bufsize=25000 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.601

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 1h 38mn
Bit rate mode                            : Constant
Bit rate                                 : 448 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Frame rate                               : 31.250 fps (1536 spf)
Compression mode                         : Lossy
Stream size                              : 315 MiB (49%)
Title                                    : Surround
Language                                 : English
Default                                  : Yes
Forced                                   : No
Here is output on my last attempt (after swapping in the current handbrakeCLI):
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 972 MiB
Duration                                 : 23mn 10s
Overall bit rate                         : 5 865 Kbps
Encoded date                             : UTC 2016-02-27 18:25:38
Writing application                      : mkvmerge v8.6.1 ('Flying') 64bit
Writing library                          : libebml v1.3.3 + libmatroska v1.4.4

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                                 : 23mn 10s
Bit rate                                 : 5 607 Kbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (29970/1000) fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.090
Stream size                              : 929 MiB (96%)
Writing library                          : x264 core 142 r2479 dd79a61
Encoding settings                        : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=8 / 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=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=300 / keyint_min=30 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / 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 range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 23mn 9s
Bit rate mode                            : Constant
Bit rate                                 : 256 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Frame rate                               : 31.250 fps (1536 spf)
Compression mode                         : Lossy
Stream size                              : 42.4 MiB (4%)
Default                                  : Yes
Forced                                   : No
Feb 27, 2016 at 9:37 PM
Edited Feb 28, 2016 at 12:35 AM
Sorry, I ran out of space above; Here is the profile I'm using; I deduced that the stuff in the order line seemed to indicate just the order an encoder is tried by MCEBuddy, and I want to produce VBR output that is essentially the same quality as the MPEG2 TS that it's coming from (though I haven't figured out settings that help enough with high motion for me to be happy with the result yet - but that is a problem for another time). Note that I ran Process Explorer to gather the commandline used when Handbrake ran HandbrakeCLI on something to get these parameters, then I meshed it with some of the existing stuff that MCEBuddy was already doing in its MKV profiles.
[MKV CRF 20 SW]
Description=High profile, quality 20 x264, high quality 1 pass MKV (H.264/AC3).  Forced software encoder using handbrake.
order=handbrake
handbrake-general=--decomb --loose-anamorphic --modulus 2 --verbose=2 -O
handbrake-video=--start-at duration:3 -e x264 -q 20 --vfr --encoder-preset=slow --encoder-level="4.1" --encoder-profile=high
handbrake-audio=-E ffac3 -R auto -B 160 -D 0 -a 1,2,3,4,5
handbrake-audioac3=-E ffac3 -R auto -B 256 -D 0 -a 1,2,3,4,5
handbrake-ext=.mp4
handbrake-remuxto=.mkv
handbrake-audiodelay=skip
PreConversionCommercialRemover=true
SkipCropping=true
And just to throw in another MediaInfo output, here is one file that was done with the original MCEBuddy 2.4.3 software, but with the profile above (just to be clear, my swapping the eac3to and handbrake executables, etc. out did nothing to help or hurt my situation from what I can tell; I think there must be some encoder setting I'm missing).
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 1.98 GiB
Duration                                 : 46mn 46s
Overall bit rate                         : 6 075 Kbps
Encoded date                             : UTC 2016-02-26 23:05:15
Writing application                      : mkvmerge v8.6.1 ('Flying') 64bit
Writing library                          : libebml v1.3.3 + libmatroska v1.4.4

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                                 : 46mn 46s
Bit rate                                 : 5 817 Kbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (29970/1000) fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.094
Stream size                              : 1.90 GiB (96%)
Writing library                          : x264 core 144 r2525 40bb568
Encoding settings                        : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=8 / 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=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=300 / keyint_min=30 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / 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 range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 46mn 46s
Bit rate mode                            : Constant
Bit rate                                 : 256 Kbps
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 KHz
Frame rate                               : 31.250 fps (1536 spf)
Compression mode                         : Lossy
Stream size                              : 85.6 MiB (4%)
Language                                 : English
Default                                  : Yes
Forced                                   : No
Lastly I wanted to mention that I've tried using Haali media splitter, LAV media splitter, and Gabest's (I think; I was up really late last night). I tried using FFDShow and LAV for decoding (disabling Windows Media Foundation for .mp4, .m4v, and .mp4v using the Win7DSFilterTweaker tool). Every method I use yields the same results - the MKVs that are resulting from Bluray or DVD rips play and skip fine using whatever Directshow filter I chose, whereas the MKVs that come from MCEBuddy do not use Directshow and therefore won't allow skipping or fast-forwarding within WMC. Also, GraphStudio shows the same thing for all files (basically whatever choice I made in the Win7DSFilterTweaker tool shows as taking effect for all of these files in the GraphStudioNext GUI).
Mar 2, 2016 at 5:32 AM
I'm getting the impression that the users of this software do not use Emby WMC to organize and play back their archived content. Bummer. For my DVD and Bluray collection it works great. I just want it to work for TV content; up to now I've just been buying larger and larger HDDs to increase the amount of recorded content I could retain, but the amount of space I can save with this software is too great to ignore... If I could watch it within WMC on my HTPC. I can't have the family switching apps to watch some things and using WMC to watch others.

Since these posts I've tried using the default MP4 high quality profile, using ffmpeg from the default high quality MKV profile, modifying the ffmpeg arguments to attempt to duplicate the handbrake settings I had been using, used handbrake and ffmpeg independently to force the output frame rate to a constant value (29.97 for handbrake and 30000/1001 for ffmpeg; though the source I was using to test the result was apparently twice that). So far, nothing has changed the fact that WMC tries to use its own Windows Media Foundation crap to decode the resulting file instead of using LAV, like the MKVs created through handbrake or ripbot from DVD/Bluray sources. I've also realized that my quality complaint (that originally caused me to look into modifying the profiles) was actually caused by that same decoder. Whatever I make looks bad being played through WMC but looks much better through MPC-HD (LAV).

Now I'm thinking of looking more closely at the encoding settings and the video information being added. The encoding settings that MediaInfo reports differ between various rips anyway so I didn't think it likely I needed to look there. Also the Color information isn't in the Makemkv output but it is in the Handbrake output, so I didn't think that would matter, though the values don't match between the TV and DVD source (not that they should).
Mar 2, 2016 at 12:17 PM
Check out this tool, it can selective disable Windows Media Foundation codecs for specific file types and allows you to use DirectShow Filter instead.
It called Win7DSFilterTweaker

Mar 2, 2016 at 3:09 PM
Thanks for the suggestion. I am in fact using that software, as it was the only way to get media center to play the other MKVs, I believe. If I disable Windows Media Foundation entirely using it I think that I'm no longer able to watch live TV (Ceton Infinitv 4). However, what I have been able to do is use the option to disable .MP4, .M4V, and so forth (in my original post). That allows me to watch the MKVs from the DVD/Bluray source in WMC using LAV. But something about taking the MPEG2 TS from the .wtv files and transcoding it to h.264 results in output that somehow WMC recognizes as being something it can handle, I think. Note that even when encoding to .MP4, which I've set to disable in that Win7DSFilterTweaker, WMC continues to decode without using LAV. I wonder if I should be asking folks about why that tool isn't working for this?

Also - it's kind of interesting to me that on my Windows 10 box, the Win7DSFilterTweaker lists more formats (including .MKV), but on my Windows 7 media center machine, it doesn't list .MKV.

Thanks again for the suggestion. Are you able to view the content you transcode from a cable card tuner in WMC?
Mar 16, 2016 at 4:20 AM
I wanted to update just in case anyone ever comes across this again. The entire problem for me was completely unrelated to the video encoding. The reason that the videos from MCEBuddy weren't being decoded using LAV was because they were being transcoded by Emby server, because the path substitution wasn't working properly for the folder where I was storing the newly-encoded videos. The rest of my library was in a different location and therefore the path substitution worked.

Once I fixed this (and I wasted weeks of effort encoding and re-encoding files, tweaking the parameters unnecessarily), the video quality is about as good as I could hope for and I am able to skip through the videos as expected.

Thanks for making the great tool. I'm very happy to no longer have to use workarounds to view all of my library.