mariiaan / cmdplay-pp

Next generation CmdPlay; Realtime CLI for Colour ASCII playback
MIT License
46 stars 5 forks source link

Linux binaries #3

Open steve-1507 opened 5 months ago

steve-1507 commented 5 months ago

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.

mariiaan commented 5 months ago

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.

steve-1507 commented 5 months ago

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

steve-1507 commented 5 months ago

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 :)

mariiaan commented 4 months ago

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

steve-1507 commented 4 months ago

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: @.***>

mariiaan commented 4 months ago

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

steve-1507 commented 4 months ago

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

mariiaan commented 4 months ago

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:

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)

steve-1507 commented 4 months ago

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

mariiaan commented 4 months ago

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 commented 4 months ago

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.

steve-1507 commented 3 months ago

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?

mariiaan commented 2 months ago

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/"

steve-1507 commented 2 months ago

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.

mariiaan commented 1 month ago

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!

steve-1507 commented 1 month ago

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/DGAju2hNNJ8Winehttps://youtu.be/OPBWga3l5zM

mariiaan commented 1 month ago

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!

steve-1507 commented 1 month ago

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