Dolby TrueHD passthrough - modified mpv build

I now finally tested all the patched builds on my end.

The initial patched build “build-15.02.2023-gbooker02-truehd-fix.zip” works like described in an earlier post, dropouts on these seamless branching spots. That is with files ripped before the new trueHD demuxer, pre-v1.15.4 makemkv versions. I re-ripped the disc with the newest version and with that file, the dropouts were not present that frequently anymore - almost perfect!


The next build I tested was an “internal” one that I have somehow not published. The only change in that build was changing

        /* detect discontinuity */
        if (padding_remaining < 0 || padding_remaining >= MAT_FRAME_SIZE * 2) {
            avpriv_request_sample(s, "Unusual frame timing: %"PRIu16" => %"PRIu16", %d samples/frame; assuming seek",
                                  ctx->truehd_prev_time, input_timing, ctx->truehd_samples_per_frame);

to

        /* detect discontinuity */
        if (padding_remaining < 0 || padding_remaining >= MAT_FRAME_SIZE * 50) {
            avpriv_request_sample(s, "Unusual frame timing: %"PRIu16" => %"PRIu16", %d samples/frame; assuming seek",
                                  ctx->truehd_prev_time, input_timing, ctx->truehd_samples_per_frame);

This was suggested in one of the posts over on the FFmpeg bug tracker page.

It made no change with the old wrongly ripped file, but somehow I had the feeling that it helped a bit with the correctly ripped file. I had fewer drops on the merged spots compared to the “15.02.” build. But could also be purely a placebo one.

Here is a link to download that build:

I would appreciate it if someone could also test this build. If it works better I will probably merge it into my ffmpeg fork repo. (explanation later in this post)


The last build tested “build-28.05.2023-truehd+commits-overlay-mod-new-truehd.zip” had no audible difference. I will probably discard those changes made there, it was a mess to get the code ([FFmpeg-devel] avformat/spdifenc: handle long TrueHD input_timing gaps - Patchwork) working with the already patched ad_spdifenc.c file.


FFmpeg repo

Over at GitHub - mitzsch/FFmpeg: Mirror of https://git.ffmpeg.org/ffmpeg.git I keep the old and the updated + patched versions of the trueHD passthrough logic.

  • branch master-2 holds the old trueHD logic
  • branch master-3 contains the new and patched trueHD logic

I will sync them both with the upstream code from time to time.


Compile mpv with the old or the new trueHD logic

I created a fork of the very helpful shinchiro mpv-winbuild-cmake repo and previously only made changes so it was easy for me to compile mpv with the old trueHD logic. Now I made some changes to easily compile mpv with the new or the old logic. Currently, it’s only in a testing branch => GitHub - mitzsch/mpv-winbuild-cmake at testing-branch-v1 but I just tested the patches and they work as intended. I will just make some cosmetic changes and update the instructions accordingly. So for everyone eagerly wanting to compile those versions, just clone the repo/branch, create the compiling environment, and run ninja mpv-plex-ntruehd for a mpv version with the new and patched truehd logic or ninja mpv-plex-otruehd for a mpv version with the old logic.

This might also be helpful for those who have an older machine where those -v3 builds won’t work.


If you just want to download the latest:

something is broken with d3d11 and gpu-next, working on a working build!!!
Currently uploading newer v3 builds! - non-v3 builds are currently in the works!
Working builds are now uploaded!

mpv with the new trueHD logic:
-v3 build:

-non-v3 build:

mpv with the old trueHD logic:
-v3 build:

-non-v3 build:

Is this 11.08.2023-ntrue build is the different to my master-3+mpv 0.36 build?

no, not really, it may contain some newer mpv code (state of GitHub - mitzsch/mpv: 🎥 Command line video player)

With the excellent work done by yourself and @Mitzsch on this thread I thought I would give Plex HTPC another go and I do like it. I added my local version of mpv-2.dll and tls-cert to my mpv.conf and the files play but none of the changes I make to my local mpv.conf seem to have any affect. Is this correct?

Update:. Mostly sorted but it’s a little painful.

Depending on the parameter set, it should work.

Can you explain what is painful?

That’s where I keep updates and instructions. Still WIP.

I had to Google where to place my mpv.conf. Then my audio wouldn’t work but I remembered that when using a different gui, I previously had to remove some config in order for it to work. So I tried removing my audio config and it now works. Obviously I remembered to add the certificated dn change mpv-2.dll from this thread. Also Plex by default overwrites all my input.conf key mappings which is extremely annoying.

However, the client and server are great. The new feature brought in a year ago to sync multiple servers means I don’t have to rely on my NAS as my primary server. I’m grateful that my media-player devs have built a very rudimentary unofficial plex client. Another dev has written an app enabling the use of the default player. So once I got past the mpv issues I now have Plex servers on my NAS and PC with clients on my PC and media player. Plex is so easy to set up that I will probably add clients to my other devices too :slight_smile:

Assuming you are talking about setting tls-ca-file to the cecert.pem included in HTPC, this is no longer necessary. We added this to HTPC to set this automatically several months ago. I edited my tip to reflect this.

It shouldn’t be overwriting this file. Are you sure you are putting this file in the correct place because it doesn’t look in the same place as MPV (on purpose). It is in the same dir as the mpv.conf and there is also a markdown file present which describes the usage of these files.

I shouldn’t have said overwrite. What I meant is that none of my keys assigned in input.conf are working. I put it in same location as the my modified mpv.conf. I saw the mod required to get the mpv detailed info and console back and that works which is good.

I am hoping the video preview thumbnails can replace the “thumbfast” script I was using in mpv but it’s not looking good so far.

Build is broken. fontconfig git is no longer available.

[1/62] Performing download step (git clone) for ‘fontconfig’
FAILED: packages/fontconfig-prefix/src/fontconfig-stamp/fontconfig-download /home/vernd/mpv-winbuild-cmake/build64/packages/fontconfig-prefix/src/fontconfig-stamp/fontconfig-download

https://gitlab.freedesktop.org/fontconfig/fontconfig not responding.

started yesterday 504 gateway timeout error I saw a post about them restructuring their git repository.

Vern

Interesting, let’s hope they have it sorted out soon. If changes need to be made to the repository, I will update it accordingly. Thanks!

It is back up and running again. Not tested however, at least gitlab is reachable again.

Tested - working OK.

Doing a new build this AM:

FAILED: packages/libmysofa-prefix/src/libmysofa-stamp/libmysofa-build

There is an error in portable_endian.h that you will want to fix…

/home/vernd/mpv-winbuild-cmake/build64/packages/libmysofa-prefix/src/libmysofa/src/hrtf/portable_endian.h:44:72: error: missing binary operator before token “(”
44 | #elif defined(DragonFly) || defined(FreeBSD) || defined defined(NetBSD) || defined(OpenBSD)

Vern

Should work again. Synced with upstream winbuild repo.

Just did a build a few minutes ago - Getting a message - This app can’t run on your PC…

Not sure what’s happening…

Also, why is Shinchiros exe ~6K larger that your’s?

Yes I have the same thing. But only when I run mpv.exe. Plex with mpv-2.dll works fine.

Yes - shinchiros builds look strange - no v3 build , rather a gcc build The exe is the only thing I use.

I tried the gcc build from shinhiro’s site, and it fails the same way. I opened an incident on his web site.