colinkeenan / silentcast

Create silent mkv screencast and animated gif.
GNU General Public License v3.0
512 stars 22 forks source link

The wizard is quite confusing #32

Open dandv opened 7 years ago

dandv commented 7 years ago

I'm coming from Gif Recorder, which was pulled by the author. Thanks for making Silentcast free!

However, the wizard/setup experience is unnecessarily confusing IMO. There are about 5 screens before you can start recording. The second time I ran bash silentcast there were fewer dialogs, but it was unclear what exactly was being recorded, and I ended up recording my entire desktop instead of a given window (see #31).

Gif Recorder has a much simpler and more effective UI: its window is a frame (transparent, with borders and a stop button at the bottom). You resize this window to enclose the area to record, and click the Record button.

That was it. No compression step, no complicated instructions, no out of memory messages. It just worked.

Unfortunately, it truncated the last seconds of the gif, which is why I've been searching for an alternative.

colinkeenan commented 7 years ago

Gif Recorder wasn't available when I created Silentcast and appears to have been inspired by it. When I saw Gif Recorder featured on Linux Action Show, I instantly recognized it was a simplified version of Silentcast, and thought to myself, I should've offered the ability to set a default mode of operation so that it would not be necessary to go through all the settings all the time if you always wanted the transparent window for example.

I created Silentcast because there was nothing comparable available for linux at the time, and it seemed easy to put together already available tools using bash scripts. I thought I would use it for a blog I would start, but then never started the blog. So, haven't been using it or developing it other than trying to address some of the issues.

I may work on the UI before the end of this year, but not before November. Thank you for giving me a reason to look at it again though.

dandv commented 7 years ago

I realized why I ended up recording the entire screen the second time - the wizard defaults the Area to be recorded to Fullscreen, and I assumed that once I selected "Entirety of a Window", the setting would be remembered. That would be my #1 suggestion - remember the settings across sessions.

The second suggestion would be to default to Entirety of a Window, since full screen screencast tend to be very large and besides running into #31, are probably less often recorded than specific areas.

colinkeenan commented 7 years ago

Ok, those are probably simple changes. I remember very little of the details of how these bash scripts I wrote actually work. This was the one and only time in my life I did extensive bash scripting, so learned a lot in doing it, but after a couple of years of not doing any bash scripting, I will have to relearn some of it before making simple fixes like this. I may work on it before the end of October though. I will definitely make your suggested changes first.

dandv commented 7 years ago

Another suggestion: at step 2, I was unclear on what "Move the next active window to the area to be recorded, and resize manually if desired." means. The window behind silentcast is what I want to record:

image

After reading the instructions, I was tempted to resize the silentcast window itself, but that turned out not to be necessary.

Just a suggestion, maybe for new users an easier flow for Window recording would be:

  1. Bring to foreground (and not maximized) the window you want to record, and resize it as you want.

    This Silentcast dialog will stay on top.

  2. Click Start
colinkeenan commented 7 years ago

Ok, I will improve the instructions provided by this dialogue too. If I really get into working on this again, I will redo the whole UI though. I originally wanted to eliminate the need for yad by writing the dialogues in python, and I may still do that.

colinkeenan commented 7 years ago

I'm lacking motivation to fix the UI, but I've made the settings persistent (and saved in ~/.config/silentcast.conf). There's also a global /etc/silentcast.conf.

colinkeenan commented 7 years ago

I'm going to fix the UI. I'm teaching myself Gtk 3 and glade hoping to use that to redo the whole application in C with a more professional UI. That will be version 3.0 of Silentcast. I don't know if I will do a 2.6 version just fixing what I can of the UI while still using yad.

My basic idea is to make the 1st dialog something the user only sees if they choose configuration from a notification icon that is persistent. Instead of the configuration coming up every time, it will go straight to a transparent window, sized and positioned to record the active window. There would be an option in the notification icon menu to record the interior of the active window instead of including the decorations. The transparent window could, of course, be resized as well, and F11 for fullscreen. I think I could do all this still using yad and modifying the bash and python scripts, but I'll probably just go straight to version 3.0 using Gtk3 and glade, rewriting everything in C. It will take at least a month, I think.

colinkeenan commented 7 years ago

@dandv, @voor, @woodyrew, @dgmcguire, @Seth-Johnson, @sbrl, @Arkni

I made quick progress in about 10 days in December, but then stopped completely for 2 months. I got back to work this month, and now would like people to test what I've done so far. I've pushed it to the next branch.

Please checkout next and pull. Go into silentcast3 and run make. Launch with ./silentcast. Please play around with all the mouse buttons and read the notes on the screen. Try F1, F2, F3. Esc or q work for quitting, but I haven't implemented Enter yet, which is supposed to record. However, you can still record by copying the F3 results into a terminal.

(I have tested the binary with valgrind and there aren't any errors, but there are memory leaks having to do with pango (text drawing). Every gtk3 application I've tested has the same memory leaks from pango. For example, try it on galculator with valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=20 --log-file=vgdump galculator or some similar small gtk application, and search for pango in vgdump. Memory leaks from pango seem to be unavoidable with gtk3. There might be an issue with pango, but my code is fine.)

voor commented 7 years ago

I'll have to take a look at it, I've moved to Wayland as my default window manager, so I'm not able to make at the moment.

colinkeenan commented 7 years ago

Thank you for being willing to try it out. Right now, X11 is more than a make dependency, it is required to run it too. That's because X11 is needed to identify the window that was active on startup. There are features that depend on knowing that. I could eventually support Wayland by disabling those features, but for now, this is X11 only.

sbrl commented 7 years ago

@colinkeenan Cool! Unfortunately, I can't get it to build. I'm sure it's a simple issue, but I'm not sure what I need to do to fix it.

colinkeenan commented 7 years ago

@sbrl, I'm not on Ubuntu, but I think this will let you make it:

sudo apt-get install libgtk-3-dev

colinkeenan commented 7 years ago

I think you may need 2 packages

sudo apt-get install libx11-dev sudo apt-get install libgtk-3-dev

woodyrew commented 7 years ago

@colinkeenan I get the following error:

$ git clone https://github.com/colinkeenan/silentcast.git silentcast && cd $_;
$ git checkout next;
$ cd silentcast3
$ sudo apt-get install libx11-dev libgtk-3-dev
$ make
gcc -c -g -O0 -Wall -pthread -pipe  src/main.c `pkg-config --cflags --libs x11 gtk+-x11-3.0` -o main.o -I./lib
src/main.c: In function ‘setup_widget_data_pointers’:
src/main.c:582:3: warning: implicit declaration of function ‘gdk_monitor_get_geometry’ [-Wimplicit-function-declaration]
   gdk_monitor_get_geometry (gdk_display_get_monitor_at_window (gdk_display_get_default (), active_window
   ^
src/main.c:582:29: warning: implicit declaration of function ‘gdk_display_get_monitor_at_window’ [-Wimplicit-function-declaration]
   gdk_monitor_get_geometry (gdk_display_get_monitor_at_window (gdk_display_get_default (), active_window
                             ^
gcc -c -g -O0 -Wall -pthread -pipe  lib/SC_X11_get_active_window.c `pkg-config --cflags --libs x11 gtk+-x11-3.0` -o SC_X11_get_active_window.o -I./lib
gcc -c -g -O0 -Wall -pthread -pipe  src/SC_conf_widgets.c `pkg-config --cflags --libs x11 gtk+-x11-3.0` -o SC_conf_widgets.o -I./lib
gcc -o silentcast main.o SC_X11_get_active_window.o SC_conf_widgets.o -pthread `pkg-config --cflags --libs x11 gtk+-x11-3.0` -export-dynamic -lm
main.o: In function `setup_widget_data_pointers':
/home/andrew/bin/silentcast/silentcast3/src/main.c:582: undefined reference to `gdk_display_get_monitor_at_window'
/home/andrew/bin/silentcast/silentcast3/src/main.c:582: undefined reference to `gdk_monitor_get_geometry'
collect2: error: ld returned 1 exit status
makefile:22: recipe for target 'all' failed
make: *** [all] Error 1

✘-2
Arkni commented 7 years ago

Hi @colinkeenan I had to add -std=gnu99 to the gcc args, but even after doing so, I got the same error as @woodyrew. If I use -std=c99, I get a different error:

gcc -c -std=c99 -g -O0 -Wall -pthread -pipe src/main.c `pkg-config --cflags --libs x11 gtk+-x11-3.0` -o main.o -I./lib
src/main.c: In function ‘get_ffcom’:
src/main.c:383:21: error: ‘PATH_MAX’ undeclared (first use in this function)
   char ffcom_string[PATH_MAX + 128];
                     ^
src/main.c:383:21: note: each undeclared identifier is reported only once for each function it appears in
src/main.c:383:8: warning: unused variable ‘ffcom_string’ [-Wunused-variable]
   char ffcom_string[PATH_MAX + 128];
        ^
src/main.c: In function ‘setup_widget_data_pointers’:
src/main.c:582:3: warning: implicit declaration of function ‘gdk_monitor_get_geometry’ [-Wimplicit-function-declaration]
   gdk_monitor_get_geometry (gdk_display_get_monitor_at_window (gdk_display_get_default (), active_window), &monitor_geometry);
   ^
src/main.c:582:3: warning: implicit declaration of function ‘gdk_display_get_monitor_at_window’ [-Wimplicit-function-declaration]
src/main.c: In function ‘get_ffcom’:
src/main.c:398:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [main.o] Error 1

By the way, here is my setup:

$ uname -a
Linux Mihawk-PC 3.13.0-112-generic #159-Ubuntu SMP Fri Mar 3 15:26:07 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty

$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
colinkeenan commented 7 years ago

I will try to figure out what may need to be installed or changed in the makefile tonight and update when I know. The makefile was something new to me and I clearly didn't make a portable one.

colinkeenan commented 7 years ago

Now that I have time to look at the errors, it seems my makefile is OK (but some people have to add -std=gnu99 for some reason). The problem is that I didn't use any deprecated Gtk functions and gdk_display_get_monitor_at_window is the 3.22 way for me to find the monitor that the active window is on. I don't know what deprecated function did that in the past.

I didn't know before learning Gtk+ that there are so many things that break from one version to the next. It seems that I would have to write a different version of Silentcast for each version of Gtk, or else find a way to only use functions that are common to all versions after whatever is on Ubuntu 14.04.

What version of Gtk is on your system?

I found this guide for setting up other environments for building packages in Ubuntu: https://wiki.ubuntu.com/SimpleSbuild

But, it looks like a lot of work for people that are not doing a lot of packaging for Ubuntu.

Does anyone have Ubuntu 16.10? Can you make Silentcast on 16.10?

Seth-Johnson commented 7 years ago

I had to install libgtk-3-dev on 16.10. Once that was done this is the output:

➜  silentcast3 make
gcc -c -g -O0 -Wall -pthread -pipe  src/main.c `pkg-config --cflags --libs x11 gtk+-x11-3.0` -o main.o -I./lib
src/main.c: In function ‘setup_widget_data_pointers’:
src/main.c:582:3: warning: implicit declaration of function ‘gdk_monitor_get_geometry’ [-Wimplicit-function-declaration]
   gdk_monitor_get_geometry (gdk_display_get_monitor_at_window (gdk_display_get_default (), active_window), &monitor_geometry);
   ^~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:582:29: warning: implicit declaration of function ‘gdk_display_get_monitor_at_window’ [-Wimplicit-function-declaration]
   gdk_monitor_get_geometry (gdk_display_get_monitor_at_window (gdk_display_get_default (), active_window), &monitor_geometry);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -c -g -O0 -Wall -pthread -pipe  lib/SC_X11_get_active_window.c `pkg-config --cflags --libs x11 gtk+-x11-3.0` -o SC_X11_get_active_window.o -I./lib
gcc -c -g -O0 -Wall -pthread -pipe  src/SC_conf_widgets.c `pkg-config --cflags --libs x11 gtk+-x11-3.0` -o SC_conf_widgets.o -I./lib
gcc -o silentcast main.o SC_X11_get_active_window.o SC_conf_widgets.o -pthread `pkg-config --cflags --libs x11 gtk+-x11-3.0` -export-dynamic -lm
main.o: In function `setup_widget_data_pointers':
/home/seth/Downloads/silentcast-next/silentcast3/src/main.c:582: undefined reference to `gdk_display_get_monitor_at_window'
/home/seth/Downloads/silentcast-next/silentcast3/src/main.c:582: undefined reference to `gdk_monitor_get_geometry'
collect2: error: ld returned 1 exit status
makefile:22: recipe for target 'all' failed
make: *** [all] Error 1
colinkeenan commented 7 years ago

Well, that answers that question. Even 16.10 doesn't have gtk 3.22. I found this command that will display what version of gtk3 you have:

pkg-config --modversion gtk+-3.0

@Seth-Johnson, what version does it report?

Seth-Johnson commented 7 years ago

The version is 3.20.9. Stable Ubuntu releases are usually a few releases behind GNOME upstream for stability and compatibility reasons (as you're finding, changing versions isn't always easy..). 17.04 will ship with 3.24.

colinkeenan commented 7 years ago

Thanks. I will spend some time tomorrow figuring out what version of Gtk is required for each of the functions I'm using and try to find a way to get them all below 3.20 without using deprecated functions. I may have to do more in x11 than I already do.

woodyrew commented 7 years ago

GTK version: 3.18.9 on Ubuntu 16.04.1 LTS

colinkeenan commented 7 years ago

I've searched all the source files for "gtk" and "gdk" and found a list of 75 functions. I then looked them up one by one in the documentation and put the version number listed by it. For those with no version number, I put 0.00. Then I sorted. Here's the list:

0.00 gdk_window_get_frame_extents
0.00 gdk_window_get_origin
0.00 gdk_window_move_resize
0.00 gdk_window_resize
0.00 gdk_x11_window_get_xid
0.00 gtk_adjustment_new
0.00 gtk_button_new_with_label
0.00 gtk_check_button_new
0.00 gtk_check_button_new_with_label
0.00 gtk_container_add
0.00 gtk_dialog_run
0.00 gtk_editable_set_editable
0.00 gtk_grid_attach
0.00 gtk_grid_new
0.00 gtk_grid_set_column_spacing
0.00 gtk_grid_set_row_spacing
0.00 gtk_label_new
0.00 gtk_label_set_markup
0.00 gtk_notebook_insert_page
0.00 gtk_notebook_new
0.00 gtk_radio_button_get_group
0.00 gtk_radio_button_new_with_label
0.00 gtk_spin_button_get_value
0.00 gtk_spin_button_get_value_as_int
0.00 gtk_spin_button_new
0.00 gtk_toggle_button_get_active
0.00 gtk_toggle_button_set_active
0.00 gtk_widget_add_events
0.00 gtk_widget_destroy
0.00 gtk_widget_get_allocated_height
0.00 gtk_widget_get_allocated_width
0.00 gtk_widget_get_toplevel
0.00 gtk_widget_queue_draw
0.00 gtk_widget_queue_draw_area
0.00 gtk_widget_set_app_paintable
0.00 gtk_widget_set_halign
0.00 gtk_widget_set_sensitive
0.00 gtk_widget_set_size_request
0.00 gtk_widget_set_valign
0.00 gtk_widget_set_visual
0.00 gtk_widget_show_all
0.00 gtk_window_get_default_size
0.00 gtk_window_get_transient_for
0.00 gtk_window_set_default_size
0.00 gtk_window_set_title
0.00 gtk_window_set_transient_for
2.10 gdk_screen_get_window_stack
2.10 gdk_screen_is_composited
2.14 gtk_entry_get_text_length
2.14 gtk_widget_get_window
2.18 gtk_entry_buffer_get_text
2.18 gtk_entry_buffer_new
2.18 gtk_entry_buffer_set_text
2.18 gtk_entry_new_with_buffer
2.20 gdk_display_get_default
2.20 gdk_display_get_name
2.20 gdk_screen_get_default
2.20 gtk_window_fullscreen
2.22 gdk_window_create_similar_surface
2.24 gdk_window_get_height
2.24 gdk_window_get_width
2.24 gtk_combo_box_text_append
2.24 gtk_combo_box_text_get_active_text
2.24 gtk_combo_box_text_new
2.40 g_application_send_notification
2.40 gtk_combo_box_set_active
2.40 gtk_file_chooser_dialog_new
2.40 gtk_file_chooser_get_uri
2.60 gtk_show_about_dialog
2.80 gdk_screen_get_rgba_visual
3.00 gtk_application_new
3.4 gtk_application_window_new
3.10 gtk_button_new_from_icon_name
3.22 gdk_display_get_monitor_at_window
3.22 gdk_monitor_get_geometry

Surprisingly, out of 75 functions, only 5 are specific to Gtk3. I definitely need gtk_application_new and seems like everyone should have Gtk3 3.10, so I'll keep using gtk_button_new_from_icon_name. At first I thought gtk_application_window_new was 3.40 after doing the sort, but that's because I forgot version numbers aren't like real numbers and I had added '0' to the end of any version that wasn't 3 digits. Some of the other version numbers are wrong in the same way, but it doesn't matter because I'm only concerned with the 3.0 and above versions.

So, it's just the 2 functions that everyone got errors on that I need to replace, both having to do with monitor.

colinkeenan commented 7 years ago

@Seth-Johnson, @woodyrew, @dandv, @voor, @sbrl, @Arkni,

I've found a way to avoid those monitor functions that aren't available before 3.22, however, it introduces a bug: nothing is displayed until the user clicks the mouse.

I will work on fixing that, but please check that it compiles and runs (from the silentcast3 directory) after doing a git pull. Click anywhere on the screen after running it, and then go through the various keys, clicks, drags, and scrolls to verify everything is working for you.

(P.S. you can ignore any warning about not being able to draw the widget. It's been giving that warning sometimes every since I started drawing a fullscreen translucent window. It draws anyway, and has nothing to do with this new issue where the user has to click the mouse to get the draw to show on startup.)

sbrl commented 7 years ago

sudo apt-get install libgtk-3-dev libx11-dev would dump an additional 90 packages and 88.5mb on my disk. Is that normal? Here's the full package list:

autopoint debhelper dh-autoreconf dh-strip-nondeterminism
  libatk-bridge2.0-dev libatk1.0-dev libatspi2.0-dev
  libcairo-script-interpreter2 libcairo2-dev libdbus-1-dev libdrm-dev
  libegl1-mesa-dev libepoxy-dev libfile-stripnondeterminism-perl
  libfontconfig1-dev libfreetype6-dev libgdk-pixbuf2.0-dev libglib2.0-dev
  libgraphite2-dev libgtk-3-dev libharfbuzz-dev libharfbuzz-gobject0
  libice-dev libltdl-dev libmail-sendmail-perl libmirclient-dev
  libmircommon-dev libmircookie-dev libpango1.0-dev libpcre3-dev libpcre32-3
  libpcrecpp0v5 libpixman-1-dev libpng-dev libpng-tools libprotobuf-dev
  libpthread-stubs0-dev libsm-dev libsys-hostname-long-perl libtool
  libwayland-bin libwayland-dev libx11-dev libx11-doc libx11-xcb-dev
  libxau-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev
  libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev
  libxcb-shm0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb1-dev
  libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev
  libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxkbcommon-dev
  libxrandr-dev libxrender-dev libxshmfence-dev libxtst-dev libxxf86vm-dev
  po-debconf wayland-protocols x11proto-composite-dev x11proto-core-dev
  x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev
  x11proto-input-dev x11proto-kb-dev x11proto-randr-dev x11proto-record-dev
  x11proto-render-dev x11proto-xext-dev x11proto-xf86vidmode-dev
  x11proto-xinerama-dev xorg-sgml-doctools xtrans-dev

I'm not sure whether it's a good idea to run that command....?

colinkeenan commented 7 years ago

@sbrl,

@Seth-Johnson installed just libgtk-3-dev. Maybe that will be enough. I can certainly understand not wanting to add tons of applications that you almost never use and would add to how long it takes to update your system. You could just install them to make the package, then uninstall them. Or, just wait until I do a release and @Seth-Johnson packages the update. I hope you will help and not be afraid of a lot of extra packages that you can remove later.

Arkni commented 7 years ago

Just compiled the source code and tried the package. As far as I can tell, all shortcuts are working as expected. The UI looks good so far.

The app looks very slick, for me, to use.

Note that I still needed to add the -std=gnu99 to gcc flags for the compilation to work (-std=c99 still warns about undeclared/unused vars).

Thanks for your time and also for working on improving this package.


(P.S. you can ignore any warning about not being able to draw the widget. It's been giving that warning sometimes every since I started drawing a fullscreen translucent window. It draws anyway, and has nothing to do with this new issue where the user has to click the mouse to get the draw to show on startup.)

I didn't get any warning. I think that's only true in some systems

colinkeenan commented 7 years ago

@Arkni,

Thank you for the feedback. Please answer some quick questions:

  1. Do you have more than one monitor? If so, did you try it on various monitors?
  2. Did you have to do a mouse click before anything showed up (which is a consequence of me getting rid of the 3.22 functions)?
  3. Did the rectangle show up surrounding the active window or did it show up where you clicked the mouse?
  4. If it worked (surrounded the active window), did you try changing the rectangle preferences to the other options besides starting on surrounding the active window?
  5. Did you try middle-click to make the rectangle include/not include the title bar and border?
  6. Did you try the scroll wheel to resize through the preset sizes?
  7. Did you try resizing the rectangle pixel-by-pixel using the F2 widget?
  8. Did you try the checkmark on F2 to resize the active window?
colinkeenan commented 7 years ago

@Arkni

Also, can you provide your modified makefile and I will use that instead (as long as it works for me). Although I managed to come up with a makefile that works for me, I don't have a strong understanding of it and am not sure where to put the -std=gnu99 that you mention.

Arkni commented 7 years ago

Do you have more than one monitor? If so, did you try it on various monitors?

I only have one right now. I will get one on Monday and test on it

Did you have to do a mouse click before anything showed up (which is a consequence of me getting rid of the 3.22 functions)?

Yes

Did the rectangle show up surrounding the active window or did it show up where you clicked the mouse?

Yes

If it worked (surrounded the active window), did you try changing the rectangle preferences to the other options besides starting on surrounding the active window?

Yes, and they work as expected

Did you try middle-click to make the rectangle include/not include the title bar and border?

(same as above)

Did you try the scroll wheel to resize through the preset sizes?

(same as above)

Did you try resizing the rectangle pixel-by-pixel using the F2 widget?

(same as above)

Did you try the checkmark on F2 to resize the active window?

It works sometimes, and sometimes I need to change one of the coordinates for the resize to work. But the resized window is padded by ~30px to the bottom (see screenshot) screenshot from 2017-03-24 22 26 13

As for the modified makefile. See https://gist.github.com/Arkni/4404e4657c4140790cd12f8a2422261a

colinkeenan commented 7 years ago

@Arkni

Thank you again. I have changed the makefile to what you used and it still works for me. I'm glad almost everything works. For the resizing of the active window, it works perfectly on my computer (using Plasma 5 desktop). It will be hard for me to debug it since it works for me. I will get back to that issue after fixing the mouse click and finishing the rest of the application so that it duplicates all the functionality of the old one.

Arkni commented 7 years ago

Thanks!

I will try, next week, to test silentcast on other distributions (mainly elementary OS and fedora) and provide some feedback in case any issue appears.

colinkeenan commented 7 years ago

@Seth-Johnson, @woodyrew, @dandv, @voor, @sbrl, @Arkni,

I have pushed another version that implements recording to the mkv file (but not converting to final outputs yet). I had to switch from my intended "Enter" to record to "F4" because "Enter" was triggered as soon as the program started for some reason.

To stop recording click the minimized silentcast. By the way, to see the proper icon, all you have to do is copy the silentcast icon to /usr/share/icons/hicolor/48x48/apps because all the desktops will match the name of the application to the icon with the same name in hicolor if it's not anywhere else.

colinkeenan commented 7 years ago

@Seth-Johnson @woodyrew @dandv @voor @sbrl @Arkni

I finally fixed the mouse-click bug! It took some extremely twisted logic, but now it instantly shows the green rectangle (as it originally did before I got rid of the 3.22 functions).

@Arkni, since you plan to try this on various distros, please pull this most recent version first and let me know if it's working for you too.

Arkni commented 7 years ago

I finally fixed the mouse-click bug! It took some extremely twisted logic, but now it instantly shows the green rectangle (as it originally did before I got rid of the 3.22 functions).

Just tested it and it's working as expected.

As for testing on two monitors, I tried this morning but can't get it to record the second monitor, even if I open silentcast on the second monitor and select an area to record, it does only record an equivalent area from the main monitor.

Also, when I launch silentcast on the second monitor, it doesn't surround the active window (see attached screenshot)

As for testing on other distro, I still didn't get the chance to do so. I will try to do it this weekend.

screenshot from 2017-03-28 10 41 54

colinkeenan commented 7 years ago

Thank you for testing. I guess it's time for me to hook up a 2nd monitor and fix this. I've always just been using my TV as a monitor, but I do have an actual monitor sitting around.

When you recorded, were you testing F4 and clicking the minimized silentcast to stop, or were you copy and pasting the command. It would be the same either way, I just wanted to know if you tested F4.

Did it seem like it was surrounding a window from the first monitor since it didn't actually surround anything from the 2nd monitor?

Arkni commented 7 years ago

When you recorded, were you testing F4 and clicking the minimized silentcast to stop, or were you copy and pasting the command. It would be the same either way, I just wanted to know if you tested F4.

Yes, I'm using F4 to start recording and I click on the minimized silentcast to stop.

Did it seem like it was surrounding a window from the first monitor since it didn't actually surround anything from the 2nd monitor?

When I launch silentcast, it created the green rectangle with the same size of the active window of the second monitor (In my case, it's a terminal as shown on the screenshot in my previous comment). So silentcast detects the second monitor and its active window.

In my previous comment, I meant by equivalent area an area of the same size & the same position as the green rectangle. It's something like the following: silentcast_sketch

colinkeenan commented 7 years ago

Thank you. I haven't hooked up the 2nd monitor yet, but thought about it while walking my dogs. I remembered that I never saved the x,y position of the monitor on the screen, only the width and height. It may be a simple fix.

colinkeenan commented 7 years ago

Finding a working cable for the old monitor was a little harder than fixing this issue. But I've fixed it now. Please let me know if it's working for you now. Thank you for all your help.

Arkni commented 7 years ago

I confirm. It does fix the problem for me.

Also, for the issue I mentioned in my previous comment https://github.com/colinkeenan/silentcast/issues/32#issuecomment-289719412:

Also, when I launch silentcast on the second monitor, it doesn't surround the active window (see attached screenshot)

It's fixed with the latest commit.

Thanks!

colinkeenan commented 7 years ago

Thanks for confirming. Those 2 problems were related, that's why they were both fixed together. The rectangle not surrounding the active window was because the green rectangle is positioned relative to the drawing surface that fills a transparent window, but the transparent window is positioned relative to the "screen" which may contain many "monitors". My X11 functions for finding the active window were correctly giving extra large position coordinates for the active window when it was on the 2nd monitor, so when those coordinates were used for drawing the rectangle, they were too big relative to the drawing surface, and my program was stopping the rectangle at the bottom right corner. It was the same problem in reverse that was causing the wrong monitor to be recorded: I needed to add the extra position information.

colinkeenan commented 7 years ago

Now all I have to do before releasing v3.0 is translate temptoanim from bash to C. Unfortunately, whenever I start reading my code for temptoanim, I get an urge to watch a show or even wash dishes or something. Anything seems better than that translation.

Seth-Johnson commented 7 years ago

@colinkeenan I wonder if it would be easier to use ImageMagick to convert temp.mkv directly to a .gif rather than split it into images first. like this: http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast/107735#107735

I know ImageMagick as a C++ API, but I don't know about pure C.

colinkeenan commented 7 years ago

But that link leads to a solution where the video is first split into "jpeg screenshots" using mplayer, and then those jpegs are converted to the final animated gif. From the point of view of ImageMagick, it's no different than what I'm doing.

Also, I wasn't really planning to use ImageMagick as an API. I was going to spawn the convert command just as I did with ffmpeg. However, now that I know an API exists for C++, I will look into whether or not it's available for C.

colinkeenan commented 7 years ago

Turns out ImageMagic has an API for every language you can think of. They have 2 for C, and they recommend the higher level one: https://www.imagemagick.org/script/magick-wand.php

colinkeenan commented 7 years ago

Turns out ffmpeg has a C API too. I should probably use it because for now, I can only stop ffmpeg by spawning "pkill -f ffmpeg" which would stop all ffmpeg commands running at the time, which is not really what I want to do.

https://trac.ffmpeg.org/wiki/Using%20libav*

colinkeenan commented 7 years ago

@Seth-Johnson @woodyrew @dandv @voor @sbrl @Arkni

Although I've got more to do before it can be released and packaged, it basically works. Please test and let me know what UI problems you are having and that you find unacceptable. For this release, I'm planning to leave the UI how it is now, but will fix anything that's obviously not working how I intended.

I have ideas for improving the temptoanim part of the UI. For now, it puts up a dialog while each spawned command is running and then closes the dialog when done. This is ugly and confusing, especially if a dialog is hiding behind something or they pop up in various different locations because the desktop is set to show windows where the mouse is. However, this is basically what the bash version was doing.

My idea for a future release is to put up one dialog listing all the steps. Then as each command runs, a progress bar will be displayed next to that step. Once the spawned command is finished, the progress bar will be full and the next progress bar will start. All of this will take a lot of programming and getting this far was already 5 times harder than I expected.

I figured out more about controlling spawned applications and didn't see any advantage to using an API instead of just spawning. In fact, I see a disadvantage to using the API - what if they have a different version?

Working on this "temptoanim" part of the application reminded me how tedious even the bash version was. This was far more tedious, and the most straightforward translation to C didn't work because it was trying to run everything at once. I ended up running a watch_child on each spawned command and running the next command in the callback function that runs when the spawned command ended. All the logic of temptoanim ended up in being called from that callback function. It took me a long time to decide this was what I had to do.

colinkeenan commented 7 years ago

@Seth-Johnson @woodyrew @dandv @voor @sbrl @Arkni

It's usable so went ahead and did a release of v3.0. Seth, I hope you will package it for Ubuntu. There are certainly bugs that need to be worked out and many further UI improvements yet to be made. I want to release it now and find out what's important to fix first though.

One thing I realize is that by recording uncompressed video and turning it into high quality pngs, the animated gif has to be very small since Imagemagick convert does everything in memory. The link you pointed me to has the advantage of recording compressed video so the pngs are probably smaller and therefore a longer gif can be created. I will eventually add choices for the initial recording, but will relax for while waiting to see what bugs people need fixed right away. Advantages to recording uncompressed video beyond higher quality is that the cpu/gpu don't have to do much and so even low end processors can do it.

colinkeenan commented 7 years ago

@Seth-Johnson,

The ./install [DESTDIR] script can be called directly from a PKGBUILD instead of copying it's contents. Here's the relevant part of the PKGBUILD for Arch Linux:

package() {
  cd "$pkgname-$pkgver"
  make
  ./install "$pkgdir/"
}
Arkni commented 7 years ago

Hi @colinkeenan

Thanks for the updates.

Just pulled the latest changes and compiled. I just noticed a bug which is the spawned ffmpeg is still running even after generating the animated gif.

Here are the steps I followed:

  1. run silentcast: $ ./silentcast
  2. press RETURN to start recording
  3. click on the silentcast icon to stop recording. A popup is shown which indicate the start of generating png files.
  4. By the time the previous task has finished, a new popup shown in order to select whether to keep or remove the generated png files.
  5. silentcast start generating the animated gif (which a little big. 3 Mo for 1 min of recording. But you already knew about this issue)
  6. After 5 is finished, silentcast is reset to the initial UI (the green rectangle) but the ffmpeg process is still runing and the temp.mkv video continue to grow even after I quit silentcast.

Also, I see an error on my terminal related to the video file:

Read error temp.mkv: Input/output error

Testing on other distributions:

I did a quick test using elementary OS 0.4 (based on Ubuntu 16.04 LTS). After running silentcast, the desktop switch immediately to the next workspace (elementary OS has 2 workspaces by default, but it expend dynamically as you need it). Als, the initial UI of silentcast is hidden and it is no where to be found. The installed gtk version is 3.18.

I still hadn't a chance to test on fedora, though.

Thanks!