8

For a small project of mine I want to record short screen-casts which show features of my program. Currently, I'm using a small app on my Ubuntu box which creates directly animated gif output. The drawback is, that gif has some limitations in the number of colors. If you inspect some of the gifs you may note that although it looks great, it's not perfect, especially when you look at the aliased fonts

animated gif

There are some handmade solutions, for instance the demonstration on the sublime-text site. To have something that nice, you first need to record your screen completely lossless. Most screen-casting programs I know unfortunately do compress the video.

Question: I have Ubuntu and OSX at my disposal, what (if possible free) screen-casting solutions exists which let me create lossless videos?

Extra credit for programs where I can select the region or window to record and turn off audio.

Update

To make it clear what I mean with lossless: Usually, videos are compressed with a method which is perfect for natural images/videos but horrible for images/videos having sharp edges and one-colored structures. I made two screen-casts and zoomed a small part so that those effects are visible. The first one is done with gtk-recordmydesktop with highest quality and the artifacts in the gray area are clearly visible

enter image description here

The second one is done with the small Record your Desktop tool which saves gif files directly and takes the exact pixels of the screen without compression.

enter image description here

What I want is a screen-caster which saves its videos in this raw format without the limitations of gif.

Possibly related questions:

  • I deleted my answer suggesting gtk-recordMyDesktop since it's full quality is not lossless. I just wasn't sure if it did or not. I don't have a Linux machine to test on unfortunately. Now I know, thanks for letting me know it didn't fit your needs. – AJ Henderson Jul 4 '13 at 16:51
  • @AJHenderson I would be glad about any program either Linux or MacOSX. Especially for Mac there seem to exist a lot of small tools but I have to time to try them all and they kind of never advertise can record lossless. – halirutan Jul 4 '13 at 17:12
7

FFmpeg with a lossless codec is one solution. I recall a comparison of different codecs which concluded that Apple Animation (known to ffmpeg as qtrle) gave the best quality for screen-recording.

ffmpeg -f x11grab -r 25 -s 1024x768 -i :0.0 -c:v qtrle output.mov

Stop it by opening its terminal while it is running and pressing q. Obviously change the resolution (1024x768 here) to match your own. For selecting a section of your screen, see how to grab the screen on the ffmpeg wiki.

It is possible that the ffmpeg which comes with your Linux distribution does not have the qtrle codec included. In this case you have to download and compile your own version.

  • I heard about Apple Animation as well. Let me try this. – halirutan Jul 4 '13 at 21:43
  • +1 Works perfectly. Let's wait whether someone comes up with a non-commandline program. Otherwise, this will be my accepted answer. – halirutan Jul 4 '13 at 23:21
  • If no-one suggests anything and you really want a GUI frontend, it seems to me that this would be a simple task for someone with GUI-making knowledge (i.e. not me :v), so you could probably find someone who would be willing to whip a simple frontend together in half an hour for a reasonable price, maybe even on chat.SE – evilsoup Jul 6 '13 at 16:31
  • This won't work on OS X, this is sad. – Display Name Nov 11 '14 at 4:57
  • Well, just want to thank you again for this answer. I'm using OBS with the qtrle encoding to create a perfect .mov file. Then I extract the frames and use image magick to build a very small and incredibly nice animated gif. The advantage of OBS is, that you easily set output resolution and which window or part of the screen you want to record. It lets you combine several recorded regions and audio easily. Rarely seen something like that on Linux! – halirutan Aug 23 '15 at 11:55
3

Alternatively, pipe your screen output to a second computer to record, using a device like a Blackmagic Intensity. It supports capturing to a totally uncompressed format (make sure you have an SSD or a RAID setup to record as the bitrate is very high).

So the computer you're doing the work on should have dual monitor output - mirror the display so one output goes to your monitor, the other to a PC with a BlackMagic PCIe (or USB 3.0) card in it, that records the output. Use DVI/HDMI, not VGA.

Note, the Intensity only supports video-type resolutions, so a res like 1024x768 or 1024x1024, etc. is no good - 480p, 720p, 1080p, etc. are what you'll need to mirror your display at (21" 1080p LCDs are $99 now anyways).

Then you can edit & compress the raw video any way you like.

  • Hehe, I thinkt this is way overkill but +1 for the answer. I need something quick which I can use when I have developed feature the make a screen cast. – halirutan Jul 10 '13 at 0:21
2

I had very similar requirements and eventually found on Claquette.
It's an OS X app that uses a lossless codec. While it doesn't allow you to define a screen area before recording, it has a crop feature that allows you to select a region after the recording is finished. Audio can also be turned off. Movies can be exported in various formats (including h.264, ProRes and Animated GIF).

  • 1
    Seems like a good little program. Currently, I'm doing my small gifs with Kazam which comes with Ubuntu. Then I'm using a small script built from the accepted answer to create small and high-quality gifs. +1 – halirutan May 16 '17 at 1:25
2

On OS X, seems like ScreenFlow can record in lossless (not by default, but this can be enabled in settings). Unfortunately, this application is not free. Still looking for free alternatives…

Important update!

This applies only to Screenflow 4.5.3 (and maybe some earlier versions). In Screenflow 5 this feature is gone. They advertise like they can do lossless recording, but this is a blatant lie: the "lossless" mode is using Apple ProRes, which is not lossless (and I tested the output, it indeed has artifacts), and there's no way to select some other codec (in Screenflow 4.5.3 the lossless mode is achieved by using "Animation" codec, which is qtrle, in Screenflow 5 there's no way to do this)

So… good bye, sweet prince.

Update 2

ffmpeg also can record the screen, if you learn how to use it properly.

  • Btw, I bought ScreenFlow back when you posted you answer. Even if I'm not using it for creating the small animated gifs this question targeted, it is still a very nice screen-caster that has a lot of nice features. – halirutan Aug 23 '15 at 11:51
  • ^ btw, one can choose only one from "gif" and "small". gif is a very inefficient compression. – Display Name Jun 17 '17 at 8:44
  • I would use Screenflow for this. I've got version 8, and it exports ProRes 4444 at 100% size, which is effectively lossless for most purposes. – tomh Dec 6 '19 at 15:52
  • well, it's not really lossless, and the question is about lossless only – Display Name Dec 7 '19 at 12:37
1

Here's a non-command-line option.

Try Collaaj (http://collaaj.com). Works on PC & Mac. It doesn't work on Ubuntu, but since you mentioned you have OSX, this should work just fine. I think it should do what you asked for and more. Such as region selection, selecting inputs etc.., and it also lets you upload and maintain your recordings on collaaj.com for anytime access. They have a nice set of videos here - http://collaaj.com/videos

  • Can you really record the windows of your screen with this tool? I only saw that they scroll through powerpoint or pdf files. Furthermore, I need to extract the frames of the video, which means I need to be able to store the videos locally. It seems this tools uploads it directly to share it, right? – halirutan Jul 10 '13 at 0:17
  • Halirutan, 1. yes, on PC & Mac, you can record entire screen. You can even change settings between 720P and 1080P, you can also do screen+camera at the same time. – Video Junkie Jul 18 '13 at 23:49
  • Halirutan, regarding your second question, Collaaj stores videos locally in mp4 format, in addition to giving you an option to upload to the cloud and share as a URL. Its very comprehensive. – Video Junkie Jul 18 '13 at 23:50
  • This video explains clearly - collaaj.com/9rE17cT – Video Junkie Jul 18 '13 at 23:57
0

If you need something less complicated try rec, which is mine :) https://sites.google.com/site/joopeter/

It is also free, lossless but more efficient and accurate!

  • As I wrote, I have OSX and Ubuntu at my disposal. Your program is for Windoze XP and above. – halirutan Oct 29 '13 at 12:02
0

Please excuse my tardiness to the party, this is something that I've been working with as of late lossless screen recording

Originally I was using OBS to record my screen throughout the year 2019 primarily for uploading screen recordings / cast to youtube, however I've recently began experimenting using ffmpeg to record my screen and mic have not tested recording desktop audio yet.

I started with vanilla ffmpeg settings for recording my screen, but the stock GOP setting of the recording makes it utterly painful when editing the recording in a NLE / NLA editor such as shotcut so I went back and reread the screen capture doc on the ffmpeg wiki, and noticed that screen recordings can be captured lossless using the x264 codec as long as -crf 0 the crf is set to 0 which I believe means ffmpeg will use the x264 codec will not apply any lossy compression to the recording. Also the wiki suggests using -preset ultrafast in conjunction with the -crf 0 setting of the ffmpeg command. I experimented with these settings last night and the picture quality / file size is great.

I recorded my screen 4K 3840 x 2160 monitor at 30 fps and the bitrate was totally manageable, ie. I don't think it ever went above 10MB/sec, and a one minute recording was ~ 48MB, which is totally acceptable file size for archiving recordings.

Caveats

  • obviously if you do not prefer using a command line then this will probably not be for you, as I've found relying a GUI to interface with ffmpeg is not a viable thing as most GUIs I experimented with are outdated.
  • also, presently I have issues with recording audio mic and screen at the same time under a single ffmpeg process / command, so I have to split the command into two separate commands / processed and start them simultaneously to keep the audio / video in sync.
    • I run macOS 10.13.6 and I'm using the Nvidia web driver so that may be the issue why I the single ffmpeg process / command of recording screen and mic at same time is failing. Not entirely sure what the issue is. 🤷‍♂️
  • I have not come up with a solution for recording the audio in a lossless codec yet, but that will definitely be my next task to research
  • also, I'd like to convert all prior recordings ffmpeg & OBS using this new technique to preserve them for archival purposes.

You mention your converting your recordings to animated GIFs, I've used the following project to convert little screen recordings to GIFs will only work with terminal based recordings, and have had pleasant results using it. It even has a docker container that makes using it rather simple for various OSes.

I did experiment with using ffmpeg to convert and iPhone recording to animated GIF a while back which was useful for uploading the GIF to github because I believe github does not support uploading video files such as mov mkv or mp4.

Also, I did a quick search on the QTRLE codec and it seems it is not compatible with the MP4 container format, so if using something other than MOV is required you might look at using a different codec.

⚠️ the below command will require concurrently be installed.

concurrently --kill-others \ 
"ffmpeg -f avfoundation -capture_cursor 1 \
-capture_mouse_clicks 1 \
-framerate 30 
-i "1:" -c:v libx264 -crf 0 -preset ultrafast \
lossless-screen-rec.mkv 2>/dev/null" \
"ffmpeg -f avfoundation -i ":3" \
-acodec alac \
lossless-mic-.m4a 2>/dev/null"

the above command will capture the computer screen losslessly using x264 and using alac to capture microphone input losslessly as well. both formats work well for editing in a NLA/NLE editor such as shotcut.

⚠️ ":3" and 1: will vary per system running macOS

To get a list of capture devices on macOS

ffmpeg -f avfoundation -list_devices true -i ""

Anyways I know this is a lot of information, but I thought I'd share this info for the fact that I have been using ffmpeg almost daily for the past couple of weeks now so I thought I'd share what I've learned, and leave this info for future me 👴🏻

  • Welcome! Can you share a complete ffmpeg command? That would make it a lot easier for future readers to be able to use your answer. – Michael Liebman Dec 7 '19 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.