Closed probonopd closed 5 years ago
Nice idea. I'll see if I can throw some time on it.
Thanks @jackburton79 - it will help to make my future articles, feature requests and bug reports more lively ;-)
This is what Peek does on Linux:
me@host:~$ strace -s 512 -feexecve squashfs-root/AppRun 2>&1 | grep ffmpeg
[pid 8142] execve("/usr/bin/which", ["which", "ffmpeg"], 0x18c7640 /* 53 vars */) = 0
[pid 8144] execve("/home/me/squashfs-root/usr/bin/ffmpeg", ["ffmpeg", "-f", "x11grab", "-show_region", "0", "-framerate", "10", "-video_size", "1045x664", "-i", ":0.0+120,255", "-filter:v", "scale=iw/1:-1", "-codec:v", "libx264rgb", "-preset:v", "ultrafast", "-crf", "0", "-y", "/home/me/.cache/peek/peekEE7I5Z.mkv"], 0x18c7640 /* 53 vars */) = 0
(...)
[pid 8152] execve("/home/me/squashfs-root/usr/bin/ffmpeg", ["ffmpeg", "-y", "-i", "/home/me/.cache/peek/peekEE7I5Z.mkv", "-vf", "fps=10,palettegen", "/home/me/.cache/peek/peekW6J44Z.png"], 0x18c7640 /* 53 vars */) = 0
[pid 8167] execve("/home/me/squashfs-root/usr/bin/ffmpeg", ["ffmpeg", "-y", "-i", "/home/me/.cache/peek/peekEE7I5Z.mkv", "-i", "/home/me/.cache/peek/peekW6J44Z.png", "-filter_complex", "fps=10,paletteuse", "/home/me/.cache/peek/peekY0KD5Z.gif"], 0x18c7640 /* 53 vars */) = 0
which translates to
# Grabbing to a temporary file which needs to be cleaned up afterwards
ffmpeg -f x11grab -show_region 0 -framerate 10 -video_size 1045x664 -i :0.0+120,255 -filter:v scale=iw/1:-1 -codec:v libx264rgb -preset:v ultrafast -crf 0 -y /home/me/.cache/peek/peekEE7I5Z.mkv
# Converting the temporary file to gif after the recording is complete
ffmpeg -y -i /home/me/.cache/peek/peekEE7I5Z.mkv -vf fps=10,palettegen /home/me/.cache/peek/peekW6J44Z.png
ffmpeg -y -i /home/me/.cache/peek/peekEE7I5Z.mkv -i /home/me/.cache/peek/peekW6J44Z.png -filter_complex fps=10,paletteuse /home/me/.cache/peek/peekY0KD5Z.gif
Looks easy enough, to me, do you think you can add it?
Thanks so much :+1:
It's done (in a very rough way) in current master. Before releasing I need to polish it a bit, though, because I think I introduced a couple of memory leaks, plus the user experience isn't pretty when you create a GIF.
Thanks @jackburton79. Seems you are using bmp intermediary files, why?
The colors are funny:
Thanks @jackburton79. Seems you are using bmp intermediary files, why?
Because it's easier this way and currently the GIF conversion is sort of an hack. What's missing is deleting the intermediary files.
The colors are funny:
No idea yet. Yesterday when I finished it was too late to check.
Let's try whether the commands I have extracted from Peek give better results.
Let's try whether the commands I have extracted from Peek give better results.
I tried with the commands you extracted but with no changes. Anyway, I fixed another problem and it seems the colors are correct now (in master)
Thanks @jackburton79 highly appreciated.
Thanks for this very useful application.
BeScreenCapture should have an option to export to animated GIFs, like Peek has. It can be done with
ffmpeg
, which is available on Haiku.Here is the code that does it:
https://github.com/phw/peek/blob/e967c3167b1dae3237480402f48fc7b6eba1f659/src/post-processing/ffmpeg-post-processor.vala
Reference: https://medium.com/@probonopd/my-sixth-day-with-haiku-under-the-hood-of-resources-icons-and-packages-abec8d0e4ec6