Setting libavcodec as the default media codec handler

Questions about Wine on Linux
Post Reply
bgc
Level 1
Level 1
Posts: 5
Joined: Mon Aug 08, 2022 5:29 pm

Setting libavcodec as the default media codec handler

Post by bgc »

Is it possible to make Wine use libavcodec as the default handler for media codecs? I am building from the main branch, and I managed to get an old game almost fully working: the music wouldn't play due to a missing Windows Media codec. I tried installing wmp9 with winetricks but it failed because I am using a WoW64 installation Wine prefix.

Through some analysis, I think the game is using the IBaseFilter interface of the Windows Media Source filter (documented here: https://learn.microsoft.com/en-us/windo ... rce-filter), to play the WMA files, if that helps.
bgc
Level 1
Level 1
Posts: 5
Joined: Mon Aug 08, 2022 5:29 pm

Re: Setting libavcodec as the default media codec handler

Post by bgc »

As I'm unable to edit my post, the old game in question is the original version of Monopoly Tycoon. When I built the WOW64 version of Wine, I built the 32bit version of Wine without FFMPEG, which actually helped bypass a codec (known as "MPEG-1 System Stream"), preventing the intro video, and the game from running.
Baustein
Level 1
Level 1
Posts: 7
Joined: Thu Jun 19, 2025 3:53 pm

Re: Setting libavcodec as the default media codec handler

Post by Baustein »

bgc wrote: Sat Jun 14, 2025 4:40 am Is it possible to make Wine use libavcodec as the default handler for media codecs?
Probably not. If Wine could just use ffmpeg, there would be no need to keep codec verbs around in winetricks.
bgc wrote: Sat Jun 14, 2025 4:40 am the music wouldn't play due to a missing Windows Media codec
Check this answer.
bgc wrote: Sat Jun 14, 2025 4:40 am but it failed because I am using a WoW64 installation Wine prefix
WoW64 is still experimental, duh. You can create a parallel 32-bit or 64-bit wineprefix by specifying the path to it with the WINEPREFIX environment variable (place it in front of every “wine” command). I use 8 and a shell script to select prefix at runtime. On the other hand, you can try opening the installer .exe with an archiver (like engrampa) and see, if you can just extract DLLs from there to your prefix. Then you’ll only have to place overrides (built-in – native) as necessary. Stuffing the prefix with ordinary codecs should probably be the first step, though (see the link above).
bgc wrote: Sat Jun 14, 2025 4:40 am Through some analysis, I think the game is using the IBaseFilter interface
Sounds like you too are on a good trip to make DirectShow work. Good luck. (No, really. It’s possible.)
bgc wrote: Sat Jun 14, 2025 4:40 am WMA
After installing Direct media DLLs, as described in the post by the link, pay close attention to ffdshow.ax, wmadmod and wmvdmod. Try setting them to native, if this doesn’t work – to built-in, if this doesn’t work either, then set them as disabled. In the worst case, unless your game is extremely picky, it should run with these DLLs disabled, only without videos.
bgc
Level 1
Level 1
Posts: 5
Joined: Mon Aug 08, 2022 5:29 pm

Re: Setting libavcodec as the default media codec handler

Post by bgc »

I would rather use git to manage changes to one prefix, instead of several, to avoid redundant copies.
However, thanks for the suggestion to use winetricks, it seems to be the easiest solution, as opposed to debugging and deriving a patch myself, either for the game, or for Wine's multimedia libraries.
rdepaoli
Level 2
Level 2
Posts: 19
Joined: Wed Jan 29, 2025 11:43 am

Re: Setting libavcodec as the default media codec handler

Post by rdepaoli »

bgc wrote: Fri Jul 04, 2025 1:02 am I would rather use git to manage changes to one prefix, instead of several, to avoid redundant copies.
However, thanks for the suggestion to use winetricks, it seems to be the easiest solution, as opposed to debugging and deriving a patch myself, either for the game, or for Wine's multimedia libraries.
Good morning bgc.

Apologies for a non-Wine related observation.
bgc wrote: the old game in question is the original version of Monopoly Tycoon
bgc wrote: it seems to be the easiest solution, as opposed to debugging and deriving a patch myself, either for the game, or for Wine's multimedia libraries
Assuming that version you are using is Monopoly Tycoon Windows - 2001 by Deep Red Games Ltd., and your main aim is to just get the program to work, then you might want to search myabandonware.

Apparently some Windows users created a number of patches and fixes to get it to work under recent Windows - those might fix your issues running it under Wine.
Patch v1.4, Music Fix Installer v1.6, NoCD For version 1.4
bgc
Level 1
Level 1
Posts: 5
Joined: Mon Aug 08, 2022 5:29 pm

Re: Setting libavcodec as the default media codec handler

Post by bgc »

OK. I managed to get the game to run, albeit, without the music. The following solution came after trying to use codec packs, windows media player to no success.

First, I built gstreamer myself, using this toolchain file :

Code: Select all

[binaries]
c = ['gcc', '-m32']
cpp = ['g++', '-m32']
rust = ['rustc', '--target', 'i686-unknown-linux-gnu']
pkgconfig = 'i686-pc-linux-gnu-pkg-config'
cups-config = 'cups-config'
llvm-config = 'llvm-config32'
strip = 'strip'
rustdoc = 'rustdoc'

[properties]
bindgen_clang_arguments = ['-m32']

[built-in options]
c_args = ['-m32']
c_link_args = ['-m32']
cpp_args = ['-m32']
cpp_link_args = ['-m32']
libdir = 'lib32'

[host_machine]
system = 'linux'
subsystem = 'linux'
kernel = 'linux'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'
I built gstreamer with:

Code: Select all

meson setup --cross-file ~/Documents/linux32 build
After building, I installed to /opt/gstreamer_32bit:

Code: Select all

sudo DESTDIR=/opt/gstreamer_32bit meson install
.

Then, at last, I installed the DXVK DLL's into my wine prefix, and ran the game:

Code: Select all

export PATH=/opt/gstreamer_32bit/usr/local/bin:/opt/wine-build-64bit/bin/:$PATH \
export GST_PLUGIN_PATH=/opt/gstreamer_32bit/usr/local/lib32 \
export WINEDEBUG=-all \
wine ./mc.exe
Baustein
Level 1
Level 1
Posts: 7
Joined: Thu Jun 19, 2025 3:53 pm

Re: Setting libavcodec as the default media codec handler

Post by Baustein »

bgc wrote: Fri Jul 04, 2025 1:02 am I would rather use git to manage changes to one prefix, instead of several, to avoid redundant copies.
May be not a good idea, since
 - when you attach a “hard drive” in wine options (winecfg), the folder gets symlinked into the prefix;
 - a prefix may not be as lightweight as you think, if only you’re not keeping the installed programs somewhere outside a prefix (I do that, but that requires some shell magic to keep the prefix management simple);
 - many programs require wineprefix to be stuffed with custom libraries. And while the “my stuffed with dlls prefix” works, some day a program may install something to it without asking you first and break the prefix for other programs. In this case it’s simpler to just wipe it and create anew, instead of fiddling around for weeks to seek what exactly was broken. The last thing you’d want here is to additionally keep the git tree in order.
Post Reply