phw / peek

Simple animated GIF screen recorder with an easy to use interface
GNU General Public License v3.0
10.25k stars 319 forks source link

Wrong recording area size on HiDPI screens #98

Closed phw closed 7 years ago

phw commented 7 years ago

Reported by @fbruetting on https://github.com/phw/peek/issues/33#issuecomment-284572525:

Well, doesn't work under Wayland at my station at all. I just see the resolution "562x0" – no matter how > big the size of the window is, and:

$ GDK_BACKEND=x11 peek
Using screen recorder backend gnome-shell
Error: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Invalid > params
Error: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Invalid > params

The errors are likely due to the height being set to 0. Now the height shouldn't make a problem at all, that part even is supposed to work natively on Wayland. Could be a GTK bug. Also the width seems to be off. Cannot reproduce here.

@fbruetting: Can you give details about which OS you use and the versions of Gnome, GTK and probably Wayland / XWayland.

fbruetting commented 7 years ago

I use latest Fedora 25 with Gnome 3.22.2, GTK 3.22.9 and libwayland-{client,serer} 1.12.0.

phw commented 7 years ago

I had speculated it would maybe be older versions. Could you run Peek with

G_MESSAGES_DEBUG=all peek

and post the output while resizing here?

I probably need to install Fedora to actually test this.

phw commented 7 years ago

Ok, tested this on Fedora 25, cannot reproduce at all. The displayed recording area always displays correctly in the window and the video produced is also of correct size. Tested on X11 and Wayland (both with Wayland and X11 backend).

I would appreciate if you could install the latest version from master (I just realized the stable release does not output debug info on resizing as the master does) and post the debug output from your system, maybe this gives some clue.

fbruetting commented 7 years ago

Now it's "714x4". Here's the console output:

$ GDK_BACKEND=x11 peek
Using screen recorder backend gnome-shell
Could not start recording, already an active recording using org.gnome.Shell.Screencast?
phw commented 7 years ago

Please give the console output of

G_MESSAGES_DEBUG=all GDK_BACKEND=x11 peek

Try resizing the window, there should be debug output about the recording area size.

fbruetting commented 7 years ago

Here's the output, maybe it's due to my UHD screen. But further the recording area turns completely transparent after hovering the mouse over it, I even can't see the resolution anymore.

http://pastebin.com/Kw1ZgUNV

phw commented 7 years ago

Thanks a lot for this. Actually the issue is your HiDPI screen. I committed a change that I think would fix this.

As I don't have a high resolution screen and my Gnome session hangs when I attempt to set the scaling factor to anything other than 1, I would appreciate if you could test this. Please also test the recording, it could be that the gnome-shell recording does expect unscaled coordinates, so if the recorded area is off and larger than expected please tell me and I change that.

fbruetting commented 7 years ago

Pixel sizes are correct, but the screen still gets transparent when hovering the mouse over it. When starting the recording, moving the window cancels the recording. Furthermore I cannot do recording because of some ffmpeg error, as you'll see in the output. But still I got asked where to save the file?! I saved "it" and there was no file appearing in this directory.

$ GDK_BACKEND=x11 peek
Using screen recorder backend gnome-shell
Recording to file /home/frank/.cache/peek/peekZJ9XWY.avi
Recording canceled with return code 0
Recording to file /home/frank/.cache/peek/peekZE95WY.avi
convert: delegate failed `"ffmpeg" -nostdin -v -1 -i "%i" -vframes %S -vcodec pam -an -f rawvideo -y "%u.pam" 2> "%Z"' @ error/delegate.c/InvokeDelegate/1332.
convert: unable to open image `/tmp/magick-16203x68fOownvhwX.pam': No such file or directory @ error/blob.c/OpenBlob/2702.
convert: no images defined `/home/frank/.cache/peek/peekCWVSWY.gif' @ error/convert.c/ConvertImageCommand/3241.
Error: Der Kindprozess wurde mit Status 1 beendet
File save error: Fehler beim Holen der Informationen für Datei »/home/frank/.cache/peek/peekCWVSWY.gif«: No such file or directory
Temp file delete error: Fehler beim Entfernen der Datei »/home/frank/.cache/peek/peekCWVSWY.gif«: No such file or directory
phw commented 7 years ago

but the screen still gets transparent when hovering the mouse over it.

The screen gets transparent after a small timeout, the size indicator is only shown during resizing and shortly after.

When starting the recording, moving the window cancels the recording.

Yes, because recording while the window is moved is unsupported, and there is now way of preventing moving the window.

Furthermore I cannot do recording because of some ffmpeg error

Unfortunately convert hides all the output of ffmpeg. One way to debug what is actually happening could be to copy the temp file while recording (e.g. /home/frank/.cache/peek/peekZE95WY.avi) and run it through

ffmpeg" -nostdin -i "/home/frank/.cache/peek/peekZE95WY.avi" -vcodec pam -an -f rawvideo -y "somefile.pam"

This should give us some idea why it is failing. Also try to playback that AVI file, maybe the recording already produces a broken file. In that case please check whether the GNOME built-in screen recording works for you, or test with WebM recording in Peek.

If you cannot catch an avi file during recording, you could also look at /home/frank/.cache/peek/ if there is any left over .avi file, even though those should be cleaned up. Or you use the recorded file in https://github.com/phw/peek/issues/101 (the ZIP in the issue description).

But still I got asked where to save the file?!

Yes, because starting the post processing and showing the file dialog happens in parallel, so when the file dialog is shown it is not yet known whether the post processing will succeed.

fbruetting commented 7 years ago

Ok, MP4 and WEBM works, and somehow ffmpeg wasn't installed and I had to install it. I really thought it was installed already, however, I think this needs to be checked. Then GIF works on Wayland, too.

I ran the command with this output:

Input #0, avi, from 'peekMJGAXY.avi':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: vp8 (VP80 / 0x30385056), yuv420p, 625x545, 15 fps, 15 tbr, 15 tbn, 15 tbc
[rawvideo @ 0x555e8ddcc0a0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, rawvideo, to 'somefile.pam':
  Metadata:
    encoder         : Lavf57.41.100
    Stream #0:0: Video: pam, rgb24, 625x545, q=2-31, 200 kb/s, 15 fps, 15 tbn, 15 tbc
    Metadata:
      encoder         : Lavc57.48.101 pam
Stream mapping:
  Stream #0:0 -> #0:0 (vp8 (native) -> pam (native))
frame=  113 fps=0.0 q=-0.0 Lsize=  112772kB time=00:00:07.53 bitrate=122632.6kbits/s speed=15.6x    
video:112772kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
phw commented 7 years ago

Ok, thanks a lot for the testing and feedback, very much appreciated.

Regarding ffmpeg not found: For one Peek really needs some error feedback to users, there is already a ticket for this.

Second thing is that I want to get rid of the ffmpeg dependency when Gnome Shell recording is used. For now imagemagick still needs ffmpeg to convert the recorded video. I have to figure out if I can record with gstreamer in a format Imagemagick can use directly without conversion.

fzaninotto commented 5 years ago

I'm having the same issue with the latest version of Peek and a HiDPI screen.

Here are the logs: https://pastebin.com/Kcegqbm2

Peek used to work on my laptop, I really don't understand why it doesn't anymore.

fzaninotto commented 5 years ago

Edit: restarted my computer, and now peek works again...