You are not logged in.

#1 2017-05-06 22:10:50

dbermond
Package Maintainer (PM)
Registered: 2017-05-06
Posts: 28
Website

screencast - command line interface to record a X11 desktop

screencast is a command line interface to record a X11 desktop using FFmpeg, having support for offline recording and live streaming. It's designed to make desktop recording a simple task, eliminating the somewhat complex FFmpeg command line arguments and the need of multiple commands. It uses predefined encoder settings that should be suitable for most needs. The default settings provides a quick and affordable way to record the desktop and is YouTube ready, letting the user to be focused on just specifying the desired video size (resolution) and position. If the user doesn't want to stick with the default settings, it is possible to choose among a set of supported encoders and container formats.

screencast not only provides an easy way to record your desktop, but it also has options to automatically add some effects to the recordings, like video fade-in / fade-out, text watermarking, webcam overlay and volume increase.

Some usage examples:

Use all default settings, YouTube ready:

$ screencast myvideo.mp4

Default settings for a 1280x720 video from screen positon 200,234 with auto choosen output filename, YouTube ready:

$ screencast -s 1280x720 -p 200,234 -u

Website:
http://github.com/dbermond/screencast/

AUR packages:
http://aur.archlinux.org/packages/screencast/
http://aur.archlinux.org/packages/screencast-git/

Last edited by dbermond (2017-12-31 03:52:53)

Offline

#2 2017-05-10 18:02:20

DrZaius
Member
Registered: 2008-01-02
Posts: 193

Re: screencast - command line interface to record a X11 desktop

Nice script. A few minor suggestions:

  • x11grab should use -framerate and -video_size input options instead of -r and -s.

  • alsa should use -sample_rate and -channels instead of -ar and -ac.

The important one being -framerate: I'm not sure if the others actually make a difference (always been too lazy to test/look into it), but that's what each input device's private options are listed as.

Offline

#3 2017-05-10 19:19:35

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: screencast - command line interface to record a X11 desktop

Don't forget about good ole ffmpeg:

ffmpeg -f x11grab -s 1050x1100 -r 25 -i :0.0 screen.mp4

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2017-05-10 19:33:44

DrZaius
Member
Registered: 2008-01-02
Posts: 193

Re: screencast - command line interface to record a X11 desktop

graysky wrote:

Don't forget about good ole ffmpeg:

This screencast tool is using ffmpeg and is intended to be a less complex alternative to ffmpeg commands.

graysky wrote:
ffmpeg -f x11grab -s 1050x1100 -r 25 -i :0.0 screen.mp4

Also applicable to your example:

DrZaius wrote:

x11grab should use -framerate and -video_size input options instead of -r and -s.

And add -vf format=yuv420p output option (or the alias -pix_fmt yuv420p) if you are encoding via libx264 and want the output to play on crappy, non-FFmpeg based players such as QuickTime and WMP. If just uploading to YouTube you can ignore the option.

Offline

#5 2017-05-10 20:22:06

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,412
Website

Re: screencast - command line interface to record a X11 desktop

Well, it passes shellcheck, which is respectable for a 1400 line shell script... still, at that point you might consider a "proper" scripting language like Python or divide the script into smaller modules to ease maintenance.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#6 2017-05-10 22:39:06

dbermond
Package Maintainer (PM)
Registered: 2017-05-06
Posts: 28
Website

Re: screencast - command line interface to record a X11 desktop

DrZaius wrote:
  • x11grab should use -framerate and -video_size input options instead of -r and -s.

  • alsa should use -sample_rate and -channels instead of -ar and -ac.

The important one being -framerate: I'm not sure if the others actually make a difference (always been too lazy to test/look into it), but that's what each input device's private options are listed as.

Thank you for the suggestions and for pointing this.
I'll be investigating carefully. Just added this task to the todo list.

DrZaius wrote:

And add -vf format=yuv420p output option (or the alias -pix_fmt yuv420p) if you are encoding via libx264 and want the output to play on crappy, non-FFmpeg based players such as QuickTime and WMP. If just uploading to YouTube you can ignore the option.

Thanks again. I'm already using -pix_fmt yuv420p as a video encoding option.

graysky wrote:

Don't forget about good ole ffmpeg:

As DrZaius said, screencast uses ffmpeg internally.
It's an effort to easy/automate the ffmpeg process of desktop recording by simplifying the command line, eliminating the need for multiple commands (lossless record + encode [+ effects]), add a few effects, among other things. Everything in a single simpler command.
It raised as a script for my personal recording needs. I'm sharing with the community so maybe it could be useful to someone.

Alad wrote:

Well, it passes shellcheck, which is respectable for a 1400 line shell script... still, at that point you might consider a "proper" scripting language like Python or divide the script into smaller modules to ease maintenance.

Thank you for the suggestions. A python port is already in my todo list smile
I really considered to break into script modules but I'm still comfortable at the current size.
To be honest, the main reason for retaining in single file is the user point of view: having just a single shell script file is much simpler and mostly desired.

Offline

#7 2017-12-31 00:46:02

hossbeast
Member
From: Seattle
Registered: 2017-06-26
Posts: 24

Re: screencast - command line interface to record a X11 desktop

When I run it, it seems to run fine, but then I Ctrl+C and there is no output file.

130 master % screencast -s 1280x720 -p 1920,200 foo.mp4                                                                                                                                       
[ screencast ] video encoder   : x264 (default)                                                                                                                                               
[ screencast ] audio encoder   : aac (default)                                                                                                                                                 
[ screencast ] container format: mp4 (default)                                                                                                                                                 
[ screencast ] effects         : none                                                                                                                                                         
[ screencast ] recording                                                                                                                                                                       
ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-shared --enable-version3
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, alsa, from 'pulse':
  Duration: N/A, start: 1514680845.277294, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Input #1, x11grab, from ':0.0+1920,200':
  Duration: N/A, start: 1514680845.320317, bitrate: N/A
    Stream #1:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1280x720, 25 fps, 25 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo (native) -> ffv1 (native))
  Stream #0:0 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, matroska, to '/tmp/screencast-tmpvideo-17035-zPSxmZEJDRNfkkEdGsPs.mkv':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), bgr0, 1280x720, q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.107.100 ffv1
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      encoder         : Lavc57.107.100 pcm_s16le
frame= 1008 fps= 25 q=-0.0 Lsize=  164861kB time=00:00:40.28 bitrate=33527.9kbits/s speed=   1x
video:157082kB audio:7545kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.141502%
Exiting normally, received signal 2.
[ screencast ] error: recording error!

todd@euclid ~/aur/screencast
0 master % ll
total 72K
drwxr-xr-x 3 todd users 4.0K Dec 30 16:35 pkg
-rw-r--r-- 1 todd users 1.3K Dec 30 16:35 PKGBUILD
-rw-r--r-- 1 todd users  27K Dec 30 16:35 screencast-1.4.0-1-any.pkg.tar.xz
-rw-r--r-- 1 todd users  31K Dec 30 16:35 screencast-1.4.0.tar.gz
drwxr-xr-x 3 todd users 4.0K Dec 30 16:35 src

Offline

#8 2017-12-31 03:38:47

dbermond
Package Maintainer (PM)
Registered: 2017-05-06
Posts: 28
Website

Re: screencast - command line interface to record a X11 desktop

hossbeast wrote:

When I run it, it seems to run fine, but then I Ctrl+C and there is no output file.

Thank you for the interest in screencast.

Press the 'q' key to stop recording, not Ctrl+C (see the final note on examples section).

The signal generated by Ctrl+C will be trapped by an internal routine and smoothly abort the program. No output files will be generated.

By the way, version 1.5.0 will be released soon.

Offline

Board footer

Powered by FluxBB