Recording Desktop/Screencapturing Games on Linux Woes

Recording Desktop/Screencapturing Games on Linux Woes

Postby qubodup » 23 Sep 2013, 03:33

Ffmpeg, ALSA, GLC, pulseaudio, x264, vorbis, libvpx, kdenlive... I am currently able to record videos of my desktop using ffmpeg or glc. However, I can not capture sound while running ALSA. And there are issues with the recordings.

In this thread I want to tell you about my problems and to hear about your problems.

Note: I have an HDA-Intel/HDA ATI Realtek ALC888 onboard sound card on my FOXCONN A7GM-S 2.0 mainboard. My current alsa-info.sh information is available at http://www.alsa-project.org/db/?f=62a33 ... 52f802162c

I use my ffmpeg-based capwin script to record videos (and then convert them using my ffmpeg-based vid2webm script).

capwin lets you click on a window and then calculates its position and size using xwininfo, grep and sed to then automatically start recording. The core command of the script is
{l Code}: {l Select All Code}
ffmpeg -f alsa -i hw:0,0 -f x11grab -acodec pcm_s16le \
 -s $CAPWIN_DIM -i :0.0+$CAPWIN_XPOS,$CAPWIN_YPOS \
 -vcodec libx264 -crf 0 -preset ultrafast -threads 0 capwin-$DATE.mkv



Issue 0: Many Ffmpeg users don't have non-free codecs
This command might be an issue for systems that do not have non-free codecs. This might be easy to solve by replacing -vcodec libx264 -crf 0 -preset ultrafast with -vcodec huffyuv, a lossless codec which I assume is free. About 15 seconds of 800x600 Trigger Rally gamplay will prduce a ~90M libx264 file (video) and a ~340M huffyuv file (video). Converted to webm both are 18M. I don't know if a bigger space requirement could be a source of lagging because of bottlenecks or journaling during writing to disk (this is pure speculation) or if there might be other issues with using huffyuv.

Issue 1: Ffmpeg can't record ALSA desktop audio
My sound card's default ALSA configuration apparently makes it impossible for me to record desktop audio and my brain rejects to try to understand how ALSA works, its configuration files and consequently the instructions that I find.

I can solve this by closing all sound-using software, running pulsaudio and enabling software monitor as recording device in pavucontrol and replacing -i hw:0,0 with -i pulse.

I would much prefer to not have to use pulseaudio just for this of course.

Issue 2a: Ffmpeg video "freezing", even though game is not
Either of the codecs used above will have the issue of the video freezing in more or less regular intervals (video, freezing at 0:22)
I have not tested whether the issue is more prevalent with one of the two codecs mentioned above.

Issue 2b: Ffmpeg video jumping, audio-video out of synchronization
The video freezing issue can be 'fixed' by adding -r 30, which apparently sets a fixed frame rate of 30, which I believe makes the video pretend that there is no delay between image frames during these freezes, causing a jump (video, see first jump at 0:26), which I prefer over freezing, but this leads to audio-video not being synchronized any more, which is extremely annoying.

Issue 3: GLC video quality low
videos seem washed out and too bright (video - ffmpeg comparison). I haven't tried finding out the reason yet.

Issue 4: GLC can't record audio
See issue 1. Probably due to lack of a loopback device (speculation), GLC can't record game audio. I have not tried glc-pulseaudio-git yet.


What issues do you share? Got any solutions? :)
User avatar
qubodup
Global Moderator
 
Posts: 1671
Joined: 08 Nov 2009, 22:52
Location: Berlin, Germany

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby charlie » 23 Sep 2013, 09:53

I don't think it froze for issue 1. It seems to have dropped a bunch of frames, a very common issue with video recording.

My experience with it has been that it is far more difficult than it should be. You need a decent computer / decent graphics card and plenty of memory / disk space - otherwise you're banging your head against a proverbial wall.
Free Gamer - it's the dogz
Vexi - web UI platform
User avatar
charlie
Global Moderator
 
Posts: 2131
Joined: 02 Dec 2009, 11:56
Location: Manchester, UK

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby Julius » 25 Nov 2013, 12:13

Interesting new video editor based on qt5 and the same video engine as Kdnlive:
http://www.shotcut.org/
Also includes a linux screen and audio recording feature that seems to capture opengl content. I haven't tested it yet though.

Using HTML5 for in-video animations is an interesting idea too.
User avatar
Julius
Community Moderator
 
Posts: 3297
Joined: 06 Dec 2009, 14:02

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby Sauer2 » 25 Nov 2013, 12:50

Is it a fork, since the KDEnlive developers has disappeared?
User avatar
Sauer2
 
Posts: 430
Joined: 19 Jan 2010, 14:02

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby Julius » 25 Nov 2013, 13:21

No it seems like a new development that only uses some parts.
IMHO probably not a bad idea as you can leave behind a lot of old cruft. It seems to be able to open kdenlive files though, so switching over should be relatively easy.
User avatar
Julius
Community Moderator
 
Posts: 3297
Joined: 06 Dec 2009, 14:02

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby andrewj » 25 Nov 2013, 13:31

Not a solution, but here is an idea:

Many games use LibSDL for video and sound, so it should not be too difficult to make a modified LibSDL which captures the video and sound directly from the application and dumps it into a file for later conversion to some video format.

Perhaps it has been tried already? Otherwise it is left as an exercise for the reader :)
User avatar
andrewj
 
Posts: 194
Joined: 15 Dec 2009, 16:32
Location: Tasmania

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby Sauer2 » 25 Nov 2013, 19:13

andrewj {l Wrote}:Not a solution, but here is an idea:

Many games use LibSDL for video and sound, so it should not be too difficult to make a modified LibSDL which captures the video and sound directly from the application and dumps it into a file for later conversion to some video format.

Perhaps it has been tried already? Otherwise it is left as an exercise for the reader :)


Good idea - reminds me of the lua live debugging approach BTW - but I see at least two problems with that:

1. SDL is mainly a wrapper library, so one would have to implement this recording capabillity for several backends.
2. In many SDL games, SDL is not used for drawing operations, only to open OpenGL context. Also, SDL_mixer is not used in many cases.

Also consider that many games use Allegro, SFML or other wrappers instead.
User avatar
Sauer2
 
Posts: 430
Joined: 19 Jan 2010, 14:02

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby oln » 25 Nov 2013, 19:17

That's kind of what apitrace does.
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby Sauer2 » 25 Nov 2013, 22:10

That's cool. Also, it has more than only one developer.
User avatar
Sauer2
 
Posts: 430
Joined: 19 Jan 2010, 14:02

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby Julius » 25 Nov 2013, 22:30

Did anyone have luck doing screen recording with shotcut? For me it just captures a black screen it seems, but maybe I am doing something wrong or it is related to my Nvidia Optimus setup?

Otherwise it seems like a very promising program, and doing the effect stuff via HTML5 seems like a great idea (currently also seems to work only under Linux).
User avatar
Julius
Community Moderator
 
Posts: 3297
Joined: 06 Dec 2009, 14:02

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby gouessej » 15 Apr 2014, 11:50

Sorry to refresh this thread. My computer is quite old (2005). Each time I try to record any game it is so slow. What about Istanbul, XvidCap, Wink and RecordMyDesktop? I'll try ffmpeg and libav in command line too.
Julien Gouesse | Personal blog | Website
gouessej
 
Posts: 71
Joined: 13 Aug 2012, 18:28
Location: France

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby asdv » 16 Apr 2014, 16:44

You should you have a look at SimpleScreenRecorder. I haven't really used it myself, just downloaded it and had a quick look but it seems like the best one I've seen so far.
Previously I've tried RecordMyDesktop and Kazam. Both were pretty bad, RecordMyDesktop only saves in ogg video format which has a really low quality. Kazam can save in WebM but it didn't look much better.
Not sure how it will perform on an older PC, but try setting the encoding options to x264 and 'ultrafast'. Quality will take a hit though if you choose one of the faster settings.
It doesn't seem to be in the repo for Ubuntu (if that's what you're using) but here's how to install it:
sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder
sudo apt-get update
sudo apt-get install simplescreenrecorder
asdv
 
Posts: 19
Joined: 30 Mar 2014, 15:55

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby onpon4 » 16 Apr 2014, 17:29

I can confirm that SimpleScreenRecorder is great.
onpon4
 
Posts: 596
Joined: 13 Mar 2014, 18:38

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby gouessej » 17 Apr 2014, 10:57

Thank you. I'll build simplescreenrecorder under Mageia Linux 3, you already know configure, make, make install as usual ;)
Julien Gouesse | Personal blog | Website
gouessej
 
Posts: 71
Joined: 13 Aug 2012, 18:28
Location: France

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby Akien » 17 Apr 2014, 16:28

gouessej {l Wrote}:Thank you. I'll build simplescreenrecorder under Mageia Linux 3, you already know configure, make, make install as usual ;)

I'll have a look at packaging it for Cauldron :-)
Godot Engine project manager and maintainer.
Occasional FOSS gamedev: Lugaru, OpenDungeons, Jetpaca, Minilens.
User avatar
Akien
 
Posts: 737
Joined: 22 Feb 2014, 13:14

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby Akien » 17 Apr 2014, 19:15

Akien {l Wrote}:
gouessej {l Wrote}:Thank you. I'll build simplescreenrecorder under Mageia Linux 3, you already know configure, make, make install as usual ;)

I'll have a look at packaging it for Cauldron :-)

Done! It's only available in Cauldron (Mageia 5's development version), but you could easily create Mageia 3 RPMs following this howto: https://wiki.mageia.org/en/How_to_do_your_own_backports

If you're on a 64-bit machine, you won't be able to build the 32-bit library that easily though (it is used to record 32-bit OpenGL applications). Just tell me if that's the case, I have a Mageia 3 i586 VM at hand to build the package if need be.
Godot Engine project manager and maintainer.
Occasional FOSS gamedev: Lugaru, OpenDungeons, Jetpaca, Minilens.
User avatar
Akien
 
Posts: 737
Joined: 22 Feb 2014, 13:14

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby gouessej » 18 Apr 2014, 10:34

Akien {l Wrote}:
Akien {l Wrote}:
gouessej {l Wrote}:Thank you. I'll build simplescreenrecorder under Mageia Linux 3, you already know configure, make, make install as usual ;)

I'll have a look at packaging it for Cauldron :-)

Done! It's only available in Cauldron (Mageia 5's development version), but you could easily create Mageia 3 RPMs following this howto: https://wiki.mageia.org/en/How_to_do_your_own_backports

If you're on a 64-bit machine, you won't be able to build the 32-bit library that easily though (it is used to record 32-bit OpenGL applications). Just tell me if that's the case, I have a Mageia 3 i586 VM at hand to build the package if need be.

I'm under Mageia 3 32 bits but I have to admit that I'm not accustomed with native RPM build tools. I will use the packaged version when I switch to Mageia 4. Thank you.
Julien Gouesse | Personal blog | Website
gouessej
 
Posts: 71
Joined: 13 Aug 2012, 18:28
Location: France

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby Akien » 18 Apr 2014, 11:22

gouessej {l Wrote}:
Akien {l Wrote}:Done! It's only available in Cauldron (Mageia 5's development version), but you could easily create Mageia 3 RPMs following this howto: https://wiki.mageia.org/en/How_to_do_your_own_backports

If you're on a 64-bit machine, you won't be able to build the 32-bit library that easily though (it is used to record 32-bit OpenGL applications). Just tell me if that's the case, I have a Mageia 3 i586 VM at hand to build the package if need be.

I'm under Mageia 3 32 bits but I have to admit that I'm not accustomed with native RPM build tools. I will use the packaged version when I switch to Mageia 4. Thank you.

It won't be available in Mageia 4, since I imported it in Cauldron (i.e. the future Mageia 5). The purpose of the tutorial I linked above is to let your build a RPM even particularly if you don't know RPM build tools, the howto explains what should be done step by step.

But I can provide you with a Mageia 3 RPM later today if you want (ideally I would do a backport for Mageia 3, but there are currently issues with backports and Mageia's package manager, so I can't for now).
Godot Engine project manager and maintainer.
Occasional FOSS gamedev: Lugaru, OpenDungeons, Jetpaca, Minilens.
User avatar
Akien
 
Posts: 737
Joined: 22 Feb 2014, 13:14

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby gouessej » 18 Apr 2014, 14:51

Akien {l Wrote}:It won't be available in Mageia 4, since I imported it in Cauldron (i.e. the future Mageia 5). The purpose of the tutorial I linked above is to let your build a RPM even particularly if you don't know RPM build tools, the howto explains what should be done step by step.

You're right, it's not that difficult.

Akien {l Wrote}:But I can provide you with a Mageia 3 RPM later today if you want (ideally I would do a backport for Mageia 3, but there are currently issues with backports and Mageia's package manager, so I can't for now).

I have to repair a computer under Mageia 2 during the weekend, I'll be able to give a try to this software Monday or in the worst case Tuesday, there is no hurry but of course I would appreciate a package for Mageia 3 :) When simplescreenrecorder works on my main machine, I'll be able to make some nice videos, the first games that come to my mind are Cheeseman and LinWarrior3D.
Julien Gouesse | Personal blog | Website
gouessej
 
Posts: 71
Joined: 13 Aug 2012, 18:28
Location: France

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby Akien » 22 Apr 2014, 17:56

gouessej {l Wrote}:
Akien {l Wrote}:But I can provide you with a Mageia 3 RPM later today if you want (ideally I would do a backport for Mageia 3, but there are currently issues with backports and Mageia's package manager, so I can't for now).

I have to repair a computer under Mageia 2 during the weekend, I'll be able to give a try to this software Monday or in the worst case Tuesday, there is no hurry but of course I would appreciate a package for Mageia 3 :) When simplescreenrecorder works on my main machine, I'll be able to make some nice videos, the first games that come to my mind are Cheeseman and LinWarrior3D.

Here you are. Download those two RPMs:
http://remi.verschelde.fr/files/package ... 3.i586.rpm
http://remi.verschelde.fr/files/package ... 3.i586.rpm

And install them both with:
{l Code}: {l Select All Code}
$ cd ~/Downloads
$ su
# urpmi simplescreenrecorder-0.2.2-1.mga3.i586.rpm libssr-glinject-0.2.2-1.mga3.i586.rpm
# exit
Godot Engine project manager and maintainer.
Occasional FOSS gamedev: Lugaru, OpenDungeons, Jetpaca, Minilens.
User avatar
Akien
 
Posts: 737
Joined: 22 Feb 2014, 13:14

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby gouessej » 24 Apr 2014, 10:41

Thank you very much Akien, I'm going to test your RPMs tonight, sorry for the delay.
Julien Gouesse | Personal blog | Website
gouessej
 
Posts: 71
Joined: 13 Aug 2012, 18:28
Location: France

Re: Recording Desktop/Screencapturing Games on Linux Woes

Postby gouessej » 27 Apr 2014, 18:31

I've just tested it. It works. The screen recording is still very slow on my machine and the experimental OpenGL mode doesn't work with Java (JOGL) applications, I'm very disappointed. The library gets injected but SSR goes on claiming that no OpenGL window has been created.
Julien Gouesse | Personal blog | Website
gouessej
 
Posts: 71
Joined: 13 Aug 2012, 18:28
Location: France

Who is online

Users browsing this forum: No registered users and 1 guest