Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Recording wayland session in mp4 format? #7

Closed
FredBezies opened this issue Feb 3, 2021 · 6 comments
Closed

[Enhancement] Recording wayland session in mp4 format? #7

FredBezies opened this issue Feb 3, 2021 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@FredBezies
Copy link

Hello.

I wonder if you can add a mp4 encode option for wayland sessions? Webm is really low in quality compared to others formats.

Thanks for your answer.

@dvershinin
Copy link
Owner

Seems possible. Found here. Will try to see if it works when I'm back home (not using Linux GUI for some time).

@FredBezies
Copy link
Author

Seems possible. Found here. Will try to see if it works when I'm back home (not using Linux GUI for some time).

Thanks for your answer. It will be great to have a better quality encoder for wayland.

@dvershinin dvershinin added the help wanted Extra attention is needed label Feb 23, 2021
@dvershinin
Copy link
Owner

@FredBezies sorry to keep your waiting. I tried implementing that according to the reference link, however even the short example script there fails to work. I am not sure what's missing there.

#!/usr/bin/env python3
from dbus import SessionBus, Interface
from os import getcwd, path
from sys import argv

BUS_NAME = 'org.gnome.Shell.Screencast'
PATH_NAME = '/org/gnome/Shell/Screencast'
INTERFACE_NAME = BUS_NAME
PIPELINE='x264enc pass=qual quantizer=0 speed-preset=ultrafast ! queue ! matroskamux'

if path.isabs(argv[1]):
    name = argv[1]
else:
    name = path.join(getcwd(), argv[1])

bus = SessionBus()
screen_cast = bus.get_object(BUS_NAME, PATH_NAME)
screen_cast = Interface(screen_cast, INTERFACE_NAME)

ret, name = screen_cast.Screencast(name, {'pipeline': PIPELINE})

if not ret:
    print('Error starting screencast.')
    raise SystemExit(1)

try:
    i = input()
except (EOFError, KeyboardInterrupt):
    pass
finally:
    screen_cast.StopScreencast()

If anyone can get the recording to work with that script or point out what's missing, I'll be waiting :-)

@dvershinin dvershinin added the enhancement New feature or request label Mar 1, 2021
@lfom
Copy link

lfom commented Apr 7, 2021

@dvershinin The Python3 script above works just fine here on Wayland (Pop!_OS 20.10, like Ubuntu 20.10, Gnome 3.38.3).

Screenshot from 2021-04-06 22-19-11

By the way, I could not install your fork using either of the bellow (to ~/.local or /usr/local):

python3 setup.py install --user
sudo python3 setup.py install --prefix=/usr/local

I had to use pip (version 20.1.1 from Python3):

pip install .

and then it correctly installed as an user app to ~/.local. But then it would not open, because the ui.glade file could not be found, what was fixed in the source code easily. Maybe it is a good idea to update the README, also stating that it requires Python3? I am not sure about the minimal version tho, I have 3.8.6 here.

dvershinin added a commit that referenced this issue Apr 7, 2021
@dvershinin
Copy link
Owner

@lfom this app depends on a fair number of external libs that have to be built when installed via pip, thus such bugs, because the primary preferrable installation method is through packages. Things are not well tested when installed via pip.

In the new release ui.glade should be found fine when you install via pip.

It works with both Python 2 and 3.
For Python 2, I'm testing with Python 2.7; and it should work fine with Python >= 3.6.

Don't know what I did before in my tests, but now it magically works (both the script and from within green-recorder). Added the codes to the new release. Replaced matroskamux with mp4mux so that we have a nice mp4 file and not an mkv:

image

@FredBezies
Copy link
Author

Thanks. It seems to work with Archlinux and Gnome 40.0. At least, I have a working screen recorder for Wayland now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants