Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build for Windows #45

Closed
Greaseball0815 opened this issue Nov 9, 2023 · 18 comments
Closed

Build for Windows #45

Greaseball0815 opened this issue Nov 9, 2023 · 18 comments

Comments

@Greaseball0815
Copy link

Hello Stefan,

very nice project.
Is there a way to build it for windows?

BR
Andreas

@swesterfeld
Copy link
Owner

The only really supported platform is Linux, that is what I use to develop and test the code. However I don't think that there is something terribly Linux specific in the C++ code of audiowmark, and if there is, I would probably merge PRs to fix it. So the issue is really the "build" step, not so much making the code more portable.

The tricky thing here is that it is using autotools as a build system, which is fine on systems where autotools (aka ./configure / make / make install) is really unproblematic (Linux/macOS), but on Windows this is a bit of a mismatch. So here are a few ideas of how to use audiowmark on Windows:

  • use a virtual machine or WSL - then you have your Linux environment and everything is fine
  • use Cygwin or Mingw which provides a shell and should be able to run the configure script
  • cross compile the binary from Linux using mxe; so you'd build it on Linux but get a statically linked exe for windows
  • provide build rules for windows without autotools, for instance using a portable build system such as CMake or meson

@Greaseball0815
Copy link
Author

Hallo Stefan,

habe gesehen, du kommst aus Deutschland.
Deswegen antworte ich mal auf deutsch.

Vielen Dank für die schnelle und umfangreiche Antwort.
Ja, ich hatte in der Zwischenzeit auch schon einiges ausprobiert.
Aktuell verwende WSL mit Ubuntu 22.04. Das funktioniert erstaunlich gut soweit.

Dein Programm audiowmark konnte ich damit ganz ohne Probleme compilieren, installieren und
erfolgreich testen.

Wenn ich einen anderen Compiler wie folgt angebe,

sudo ./configure --host=x86_64-w64-mingw32

wird ein Package nicht gefunden, obwohl es installiert ist. Dann bekomme ich folgende Fehlermeldung:

"checking for _Z28zita_resampler_major_versionv in -lzita-resampler... no"

Hast du da eine Idee, wie man das lösen könnte.

Besten Dank

Gruß
Andreas

PS:
Audiowmark funktioniert auch wirklich gut. Habe mal ein wenig mit herumprobiert.
Das Wasserzeichen ist ziemlich robust. Großartig. Konvertierung zu MP3 hält es ohne Probleme stand.
Lediglich nach dem Verändern der Wiedergabegeschwindigkeit über ein gewisses Maß ( schneller / langsamer )
und trotz --detect-speed-patient wird das Wasserzeichen nicht mehr gefunden. Aber es ist nicht weg.
Korrigiert man Geschwindigkeit und nähert sich an die originale wieder an, wird es wieder lesbar.
Super Arbeit.

@swesterfeld
Copy link
Owner

For the issue tracker I think it is better to use English as a language, simply because others might want to read our discussion as well.

sudo ./configure --host=x86_64-w64-mingw32

wird ein Package nicht gefunden, obwohl es installiert ist. Dann bekomme ich folgende Fehlermeldung:

"checking for _Z28zita_resampler_major_versionv in -lzita-resampler... no"

Actually I have two ideas here. The first is that you not only need zita-resampler installed, but you need a cross compiled version of zita-resampler installed, so that it can be used for the Windows build.

The second idea is that this particular configure check did already cause some problems for others and has been therefore modified recently (e8b530d). This change is not in a released version however, so you'd have to build from git to try if that fixes your problem.

When building from git you need autoconf-archive and gettext and run ./autogen.sh instead of configure.

As for speed detection, it uses a searches a range of approximately +/- 20%.

@Greaseball0815
Copy link
Author

Hello Stefan,

Thank you again for your support and this great program.

It cost me a lot of nerves, but I did it.

I ended up using Cygwin.
Various adjustments to the source code were necessary.

libzita-resampler is not available for Cygwin.
So I had to compile it for Windows myself.

But now I have a working x32-bit and x64-bit version of Audiowmark for Windows and Linux.

BR
Andreas

@swesterfeld
Copy link
Owner

Glad to hear that you managed it! I guess you're really the first person that did it :-)

Is there something that can be done to make it easier for the next person that wants to build it on windows? For instance a quick list of steps? And if the source changes are clean enough, it might be possible to include them into the repository, so that it gets easier to build on cygwin in the future?

@Greaseball0815
Copy link
Author

Greaseball0815 commented Nov 30, 2023

Hello Stefan,

yes, I will write it down.
Give me some time because there are a lot of steps.

In the meantime I also found another way to compile it. Video support now also works.

The biggest problem was a very specific C++ method that doesn't exist under Windows.
Namely the fork() method.
But the problem is solved and it works. And as always: if you know how to do it, it's easy.

@pavelzabavin
Copy link

@Greaseball0815 Hello! It would be great if you could share the build for Windows...

@Greaseball0815
Copy link
Author

Greaseball0815 commented Feb 26, 2024

Hello Stefan.

As announced, here is a step-by-step guide for compiling audiowmark for Windows x64.

During my first attempts I had to make various changes to the source code in order to be able to compile the program. Audiowmark worked then, but had no video support.

The current approach requires very few changes to the source code and everything now works exactly like it does in Linux, including video support.

However, I had to translate the bash script for videowmark into C++, because there is no viable alternative for bash scripts on Windows, except with the help of additional software.

The porting worked. Everything works as it should.

I hope this guide will be helpful here and there.

In any case, I would be very happy.

BR
Andreas

Step-by-Step guide
Audiowmark_Win_x64_eng_build_guide.txt

videowmark.cpp
videowmark.cpp.txt

@Greaseball0815
Copy link
Author

By the way, I noticed something during my tests.
The watermark in the audio file is actually quite robust.
But there is a very simple way to remove it or make it undetectable for audiowmark.

By increasing or decreasing the tempo (not the speed) of the audio track by around 5%.

This slight change in tempo is not audible, but audiowmark no longer finds the watermark,
also not with --strength 30 ( or higher ) and --detect-speed or --detect-speed-patient.

Feel free to try it out yourself by simply changing the tempo by 5% with Audacity. And the watermark is now undetectable.
audacity_tempo

@pavelzabavin
Copy link

@Greaseball0815 Thank you very much for the instructions! Let me clarify, wouldn’t it be difficult for you to make a Portable version and post it on a file hosting service?

swesterfeld added a commit that referenced this issue Feb 29, 2024
@swesterfeld
Copy link
Owner

As announced, here is a step-by-step guide for compiling audiowmark for Windows x64.

Great, thank you! The question of how to build audiowmark on Windows really came up from different users in the past, so I hope this helps everyone who wants a Windows build. I added your guide and your videowmark C++ version to the docs/ subdirectory and put a link into the README.adoc.

But there is a very simple way to remove it or make it undetectable for audiowmark.
By increasing or decreasing the tempo (not the speed) of the audio track by around 5%.

Yes, it doesn't actually remove the watermark, it just prevents automatic detection. The watermark is still there, and should be detectable if you correct the tempo manually. We could do it automatically by implementing something similar than the speed detection algorithm we already have, just to scan for different tempos automatically. It just wasn't a high priority for me right now.

There are also newer approaches to synchronization that claim to be less vulnerable to tempo changes, for instance one paper I saw is https://arxiv.org/pdf/2308.12770.pdf

@swesterfeld
Copy link
Owner

Btw, would it help if we added something like

#ifdef __CYGWIN__
/* needed for vasprintf */
#define _GNU_SOURCE
#endif

to utils.cc to make newer versions of audiowmark build without requiring changes?

@Greaseball0815
Copy link
Author

Greaseball0815 commented Mar 1, 2024

Btw, would it help if we added something like
#ifdef CYGWIN
/* needed for vasprintf */
#define _GNU_SOURCE
#endif
to utils.cc to make newer versions of audiowmark build without requiring changes?

I just tested it in Cygwin environment. Yes, your preprocessor directive would work. So, why not?

Yes, it doesn't actually remove the watermark, it just prevents automatic detection. The watermark is still there, and should be
detectable if you correct the tempo manually. We could do it automatically by implementing something similar than the
speed detection algorithm we already have, just to scan for different tempos automatically. It just wasn't a high priority for
me right now.

Yes, the watermark is still there but undetectable by audiowmark. The watermark, that audiowmark creates, is very, very robust. It even survives recording from speaker to microphone ( through the air ). Just a great job.
But I think if audiowmark could also find the tempo diffenrence automatically ( not just the speed difference ), then it would be near perfect. Maybe you'll find the time. It would just be great.

If you want me to test something or do a beta test for you, just let me know.

BR
Andreas

swesterfeld added a commit that referenced this issue Mar 1, 2024
@Greaseball0815
Copy link
Author

Greaseball0815 commented Mar 2, 2024

Hello Stefan.

I made an update for videowmark and the build guide.
Maybe you can replace it when you have the time.

New: Added new parameter --version to get the current videowmark version
New: Added parameter supprt for --detect-speed-patient
New: Cleaned up the source code a little bit
New: Updated help text
New: Updated build guide ( already contains your changes )
Fix: Videowmark does not work properly when not launched from the current directory.

videowmark-win.cc
videowmark-win.cc.txt

win-x64-build-guide.txt ( Updated: 07.03.2024 )
win-x64-build-guide_07.03.2024.txt

BR
Andreas

@Greaseball0815
Copy link
Author

Hello Stefan.

Holy moly. I checked the Step-By-Step guide around 1000 times, but I overlooked one thing.
When developing the instructions I forgot the HLS parameter --with-ffmpeg.
In addition to this parameter, another change was required.
I have now corrected that in the guide. Sorry for the extra work.

BR
Andreas

swesterfeld added a commit that referenced this issue Mar 6, 2024
@swesterfeld
Copy link
Owner

When developing the instructions I forgot the HLS parameter --with-ffmpeg.
In addition to this parameter, another change was required.

Ok, I updated the repository with the files you attached.

@Greaseball0815
Copy link
Author

Perfect.

@gee-ell
Copy link

gee-ell commented Mar 18, 2024

@Greaseball0815 Thank you very much for the instructions! Let me clarify, wouldn’t it be difficult for you to make a Portable version and post it on a file hosting service?

@Greaseball0815 yes would you upload your Windows binary somewhere and post a link? I'd like to experiment with it before I set up a full build environment. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants