cmdplay-pp icon indicating copy to clipboard operation
cmdplay-pp copied to clipboard

Linux binaries

Open steve-1507 opened this issue 1 year ago • 18 comments

Would it be possible to provide binaries for Linux too? I know I could compile them myself, but I don't want to install a thousand tools and IDEs and dependencies. So can you please add a standard bin for Linux that can then be added to the apt / dnf / pacman repositories.

steve-1507 avatar Jan 14 '24 16:01 steve-1507

From a programming perspective, there is no problem. It would be quite easy adding linux support to the source. However currently, I am not satisfied with the way it handles audio playback. I am gonna clean up that and then, I'll be including linux-x64 binaries under release, thanks for your opinion.

mariiaan avatar Jan 15 '24 09:01 mariiaan

Thanks! It would be quite cool to watch it in a no-gui session!

steve-1507 avatar Jan 15 '24 11:01 steve-1507

So just for fun I tried to run it via Wine, and it draws around 2 frames per second. you can literally watch it go line by line and btw, Grüße aus Bayern :)

steve-1507 avatar Jan 16 '24 18:01 steve-1507

Hm yeah, I never tried that, just ran it under a windows VM and it worked pretty good, ik that doesn't have anything to do with wine. However, I recently had some time for this project, and I got so far rewriting the audio engine so that it would work under linux. I only gotta clean up some code and abstract away some os-related console functions, and then it's ready to go. Grüße aus NRW :D

mariiaan avatar Feb 21 '24 09:02 mariiaan

I'd love to help but C++ just isn't my kind of language. But still - Thank you for listening to me!Am 21.02.2024 um 10:50 schrieb Marian W. @.***>: Hm yeah, I never tried that, just ran it under a windows VM and it worked pretty good, ik that doesn't have anything to do with wine. However, I recently had some time for this project, and I got so far rewriting the audio engine so that it would work under linux. I only gotta clean up some code and abstract away some os-related console functions, and then it's ready to go. Grüße aus NRW :D

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

steve-1507 avatar Feb 21 '24 10:02 steve-1507

Yeah sure, thank you too. You're already contributing by opening issues.

mariiaan avatar Feb 21 '24 17:02 mariiaan

I know, I'd just like to actually help resolve the issue instead of just complaining about it

steve-1507 avatar Feb 21 '24 18:02 steve-1507

Hello, I made some changes to the linprep branch for using this on linux. If you want to try it out, clone the code on that branch and either build with make --makefile linux.Makefile (see the makefile for packages you need to install) or (what I currently recommend because this branch is a hot mess, including it's code quality (had to change like everything ffmpeg related because they wanna change the whole API in every update)) just use the "cmdpla" binary file which is in the root directory, ik it's kinda sketchy (I hate putting binary files in my repositories)

It's compiled for amd64 so it should run on every modern 64-Bit System which is not ARM.

For me, everything is working except anything which has to do with colours (need to look into it but I guess the ncurses library seems to prevent ANSI colour escape codes) And the frame rate seems pretty low (about ~15FPS for me, independent on the output resolution so it seems to be a terminal emulator? problem). This does not seem to be a direct issue of the program though (I did some performance monitoring, the main while loop for decoding and printing out seems to run at an iteration execution speed of 3ms which should result in ~333 FPS)

Anyway, there is lots of work to do including:

  • fixing the colours
  • looking into the FPS limit?
  • Cleaning up the code (get rid of thousands of #ifdef linux pp statements and making some kind of abstract classes for those functions)

Maybe you'll find out something, but I mainly share this so uk I'm not lazy (tmr is AP1 for my Ausbildung so will have more time after that)

mariiaan avatar Feb 27 '24 20:02 mariiaan

I'm trying to compile a working binary, but need to resolve some dependencies. Sorry for the late reply

steve-1507 avatar Feb 29 '24 19:02 steve-1507

no worries, the only dependencies i think are needed are build-essentials, g++ and those listed in the linux makefile (in a comment at the top of the file)

mariiaan avatar Feb 29 '24 21:02 mariiaan

I have noticed a slight issue when compiling on a different linux-arm64 pc. Depending on your ffmpeg distribution, you might need to add "-l/usr/include/ffmpeg" to cflags in linux.Makefile However other than that, it compiles on a fresh system.

mariiaan avatar Mar 05 '24 08:03 mariiaan

I had some difficulties with the libraries. Running make --makefile linux.Makefile returns an error since it can't find any library. You are including the libraries, right? Do they have to be in specific folders or how do I make the libs visible for compilation?

steve-1507 avatar Mar 30 '24 19:03 steve-1507

god, why didn't I see that, sorry about that. As specified in the makefile comment, you need to install the following packages: ncurses libavformat-dev libavcodec-dev libswresample-dev libswscale-dev libavutil-dev

Depending on your distribution, you need to add "-l/usr/include/ffmpeg" to CFLAGS after "-Ilib/include/"

mariiaan avatar Apr 20 '24 22:04 mariiaan

So I was able to compile a binary, but noticed some issues: FFmpeg throws an error when the file to be played isn't in the current directory Trying to enable color just displays ANSI codes, both in virtual TTY and a terminal emulater (Konsole) dithering doesn't seem to work

However, framerates are far better, and this is a massive improvement over trying to run the Windows version via Wine.

steve-1507 avatar May 04 '24 10:05 steve-1507

Yeah there are some oddities. I tried running it on ubuntu/built in terminal and it did so with a framerate of ~25FPS (virtualized). I also tried with many different console emulators but there were no changes. However, when I ran it on my hosts arch, it actually ran in the desired Framerate (even (capped) up to 120FPS). I thought this was odd and when I tried running it on a virtualized arch, it still did so fine. This probably confuses me the most. But in any cases, it still seems acceptable.

I am still yet to find the reason why the ANSI codes are not working, but that doesn't seem like a huge deal.

The thing with the ffmpeg crash is probably also due to my crappy implementation of an asynchronous video decoder. Back when I initally wrote this, it was my first time using ffmpeg as a library, so I'll fix that aswell.

Thanks for getting back to me and helping out this project!

mariiaan avatar May 08 '24 13:05 mariiaan

Haha yes, just for fun I made videos of the program playing the GTA 6 Trailer, once my compiled binary and once using Wine. If you want, you can check them out here: Native: https://youtu.be/DGAju2hNNJ8Wine: https://youtu.be/OPBWga3l5zM

steve-1507 avatar May 08 '24 13:05 steve-1507

holy shit. I expected wine to have at least like 5 fps but it seems like it doesn't even have 0.25 fps. that's actually hilarious. It seems like a big improvement running at the intended refresh rate of the video. There still seems to be a lot of flickering involved.

About earlier, you mentioned dithering would not work. Have you tried text dithering with key 'T'? Because that did work on my test system.

Thanks for sharing the videos!

mariiaan avatar May 08 '24 14:05 mariiaan

Yeah, Wine is pathetic. Dithering did work when pressing T, but B (full pixel) also doesn't do anything

steve-1507 avatar May 08 '24 14:05 steve-1507