ffmpeginteropx / FFmpegInteropX

FFmpeg decoding library for Windows 10 UWP and WinUI 3 Apps
Apache License 2.0
212 stars 53 forks source link

Subtitle Configuration: FontFamily (UWP) #377

Open softworkz opened 1 year ago

softworkz commented 1 year ago

Is this working on your side?

Initially, I wanted to get it working with a custom font supplied as appx resource, but then I realized, that it's not even working when setting a system-installed font:

FfmpegMss.Configuration.Subtitles.SubtitleStyle.FontFamily = "Impact";

At some point I got really desperate and tried this:

    for (uint i = 0; i < currentPlaybackItem.TimedMetadataTracks.Count; i++)
    {
        var track = currentPlaybackItem.TimedMetadataTracks[(int)i];

        foreach (var mediaCue in track.Cues)
        {
            var cue = (TimedTextCue)mediaCue;
            cue.CueStyle.FontFamily = "Impact";

            foreach (var textLine in cue.Lines)
            {
                foreach (var subformat in textLine.Subformats)
                {
                    subformat.SubformatStyle.FontFamily = "Impact";
                }
            }
        }
    }

But no chance to change the font. Everything else is working: Font size, font bold, foreground color, etc.

Is it working on your side?

softworkz commented 11 months ago

UWP or WinUI? Have you tried my .reg file? It is not messing around in any way. It cleanly adds an "All Defaults" configuration and sets it active, but it doesn't overwrite existing sets.

brabebhin commented 11 months ago

Ah yes forgot about the reg file. But i would like to not have to use it.

softworkz commented 11 months ago

For packaged WinUI3 apps I have figured out a solution using a .dat file. Not sure whether I mentioned it.

brabebhin commented 11 months ago

You should avoid using the word solution, it will make Microsoft not want to fix the problem.

You have not mentioned it here

softworkz commented 11 months ago

We're on the same page:

it will make Microsoft not want to fix the problem

That's why I didn't mention it there. I can explain privately how it works, if you wish.

brabebhin commented 11 months ago

No. It's ok for now, hopefully they will fix the mess early next year.