hiptext icon indicating copy to clipboard operation
hiptext copied to clipboard

Update this please

Open muziker opened this issue 5 years ago • 11 comments

Hi there, there are some changes in ffmpeg and so the interface call signatures have been changed. Update this please, so we can all enjoy the ascii goodness

muziker avatar Feb 15 '20 07:02 muziker

Found a fix for this, located here https://github.com/hzeller/timg

maxsatula avatar Dec 02 '21 04:12 maxsatula

I don't know how to compile hiptext anymore. I can't maintain it anymore because the Linux APIs it depended on kept radically changing. So I rewrote hiptext instead as two new and much better projects.

  • https://justine.lol/printimage.html
  • https://justine.lol/printvideo.html

Enjoy!

jart avatar Dec 02 '21 07:12 jart

Also if you want C code that does what hiptext does with the least amount of effort possible please see:

  • https://gist.github.com/jart/7428b2b955dfd6eff7b6d31e00414508

jart avatar Dec 02 '21 07:12 jart

I don't know how to compile hiptext anymore. I can't maintain it anymore because the Linux APIs it depended on kept radically changing.

I was actually able to compile and run hiptext, that took about an hour to figure out. All I had to do are couple replacements in src/movie.cc to address #36

  • PIX_FMT_RGB24 with AV_PIX_FMT_RGB24
  • avcodec_alloc_frame with av_frame_alloc

And borrowed an older Ragel version 6 from another machine to build pixel_parce.cc (mine had version 7 which had a known issue to throw ragel: input.c:517: input_undo_prepend_tree: Assertion `si->queue.head != 0 && ( si->queue.head->type == SB_TOKEN || si->queue.head->type == SB_IGNORE )' failed. error upon compilation attempt). That's for now, and I agree if they keep changing APIs (and they will eventually do) you'll get tired pretty soon by constantly accommodating the changes.

Anyways, I'm shopping for the best terminal image viewer, sorry about looking the other way, but you know, 256 colors are out of fashion nowadays, as there are terminals and image viewers which support True Color.

maxsatula avatar Dec 02 '21 19:12 maxsatula

If you send me a pull request with your changes that make it build, I'll merge them.

I believe the printimage.com program is the best. It uses 24-bit by default. You have to pass the -x flag if you want the retro appeal of 256 color.

jart avatar Dec 02 '21 20:12 jart

As a matter of fact, I've found an existing #52. CI fails though, perhaps because of an older version of ffmpeg library.

maxsatula avatar Dec 03 '21 23:12 maxsatula

Merged

jart avatar Dec 04 '21 03:12 jart

FWIW, I was able to build hiptext on Linux Mint 20.3 (packages based on Ubuntu 20.04 LTS). I hit a roadblock in that libfreetype-dev no longer includes the freetype-config utility, and in a few minutes of poking I couldn't find an obvious way to get it.

I hacked around it by patching configure.ac to remove the check:

diff --git a/configure.ac b/configure.ac
index d1c8217..0a4ece8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,9 +47,6 @@ AC_SUBST(LIBGFLAGS_CFLAGS)
 AC_SUBST(LIBGFLAGS_LIBS)
 
 AC_CHECK_PROGS(FREETYPE, freetype-config)
-if test -z "$FREETYPE"; then
-  AC_MSG_ERROR([error: libfreetype-dev is required])
-fi
 LIBFREETYPE_CFLAGS="`$FREETYPE --cflags`"
 LIBFREETYPE_LIBS="`$FREETYPE --libs`"
 AC_SUBST(LIBFREETYPE_CFLAGS)

…and then patching the generated Makefile to manually configure the Freetype build flags:

--- Makefile.old	2022-07-08 17:46:31.999241774 -0700
+++ Makefile	2022-07-08 17:45:23.812035049 -0700
@@ -519,4 +519,4 @@
 LIBAVUTIL_LIBS = -lavutil
-LIBFREETYPE_CFLAGS = 
-LIBFREETYPE_LIBS = 
+LIBFREETYPE_CFLAGS = -I/usr/include/freetype2
+LIBFREETYPE_LIBS = -lfreetype
 LIBGFLAGS_CFLAGS = 

That said, I later remembered how to find printimage.com (I knew there was a newer one but couldn't find it by searching @jart's repositories for image :-) ), which I agree is better anyway, so I'm mostly posting this "just in case" it helps someone later.

wchargin avatar Jul 09 '22 01:07 wchargin

Since you put in the work, if you send me a PR I'll hit merge.

jart avatar Jul 09 '22 08:07 jart

Sure; I cleaned up the patch a bit and sent #60.

wchargin avatar Jul 09 '22 18:07 wchargin

The build instructions in the readme don't work, but just cloning the repo, running ./autogen.sh, ./configure and then make do work.

pepa65 avatar Oct 31 '23 16:10 pepa65