You are not logged in.

#1 2014-08-13 05:25:02

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

FFcast 2.0 is here

For those of you who haven't heard of FFcast, it's a tool initially created to facilitate taking screencasts. I was surprised to find just recently that it rocks.

That was nice, but I'm in the process of making it a little better. Right now a new version 2.0.0-rc2 is in AUR.
This is a major version bump, which means the compatibility is broken and your old command lines may not work. But hopefully it's an improvement.
There is no NEWS or CHANGES to read. The man page and output of -h are short enough to grasp quickly.
For my dear advertisers, the GitHut repo has been renamed from FFcast2 to FFcast. Time to update your links.

For my loyal users, I hope to hear from you any feedback. But most of all, ideas of predefined sub-commands are very welcome.
For example, there is a predefined sub-command "png", which is used to take a screenshot. In essence, it's simply a shorthand, but it's typically useful enough to make it into the list of builtin sub-commands. So to take a screenshot of a window, you simply:

ffcast -w png

Convenient, isn't it? You can see what it actually does by passing -vv to ffcast, enabling debug messages. The "png" sub-command is defined as:

ffmpeg -loglevel quiet -f x11grab -show_region 1 -video_size %wx%h -i :%d+%x,%y -frames:v 1 -codec:v png -f image2 screenshot-%wx%h.png

Now, what kind of kinky stuff do you find worthwhile of a builtin sub-command? Speak up!

---
Update

Now as of FFcast 2.0.0-rc5 the sub-commands have been modularized so users can define their own custom sub-commands in ~/.config/ffcast/subcmd.
To get an idea how sub-commands are defined, refer to /usr/lib/ffcast/subcmd (spoiler: it's pretty easy!).
I have made a few more sub-commands since opening this thread, including a 'help' command that is quite helpful, see:

$ ffcast help
%	bypass predefined sub-commands, to avoid name conflicts
dump	dump region-related variables in bash code
help	print help for a sub-command, or list all sub-commands
png	take a screenshot and save it as a PNG image
rec	record a screencast
$ ffcast help rec
rec: record a screencast
subcmd_rec () 
{ 
    : 'usage: rec [-m <n>] [filename.ext]';
    local m=1 opt;
    OPTIND=1;
    while getopts ':m:' opt; do
        case $opt in 
            m)
                m=$OPTARG
            ;;
        esac;
    done;
    shift $(( OPTIND -1 ));
    local outfile=${1:-"$(printf '%s-%(%s)T.mkv' 'ffcast' -1)"};
    cmdline=(ffmpeg -f x11grab -show_region 1 -framerate 25 -video_size "${w}x$h" -i "$DISPLAY+$_x,$_y" -codec:v libx264 -vf crop="iw-mod(iw\\,$m):ih-mod(ih\\,$m)" "$outfile")
}

Obviously, with such power, we no longer have any need for the so called "double hyphen syntax". Hopefully you will like this better.

Also, if you're interested in what is going on, the best documentation for changes is in the git log.

Last edited by lolilolicon (2014-08-13 20:56:41)


This silver ladybug at line 28...

Offline

#2 2014-08-14 09:56:38

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

Hey, here's a shiny handy new one: the 'each' sub-command.

For those proud of your multi-head setups -- your screenshots are way too wide!
Now you can take screenshots for each of your screen,

ffcast -x 0,1,2 each png head_%g.png

For us common folks we can taste the flavor by doing it to the windows,

ffcast -www each png win_%g.png

Combo attack!


This silver ladybug at line 28...

Offline

#3 2014-08-15 17:27:46

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

As you know, I added the xprop dependency for the -f option, to include window frame for window selections.
The problem is not all window managers support _NET_FRAME_EXTENTS, which the -f option requires.
My current window manager i3 does not support _NET_FRAME_EXTENTS either, so I added a new sub-command 'pad', to manually pad the window selection with the size of the frame,

ffcast -w pad 20,2,2 png i3.png

By accident, I discovered that the title bar of an i3 window is actually a window itself! So the same thing can be done with the following,

ffcast -ww pad 0,0,2 png i3_2.png

you click once in your window, and once on the title bar. (EDIT: forget about it -- i3 does not set the absolute coordinates of the title bar correctly so this second method doesn't work.)

(The 'pad' sub-command is currently in Git HEAD, but not yet in a release. I don't feel like doing an -rc10.)

Last edited by lolilolicon (2014-08-16 01:02:16)


This silver ladybug at line 28...

Offline

#4 2014-08-16 11:33:51

yoyo308
Member
From: Spain
Registered: 2014-08-16
Posts: 2
Website

Re: FFcast 2.0 is here

Thanks for ffcast, work fine smile

I made a video review https://www.youtube.com/watch?v=JXlXurbdco0

Last edited by yoyo308 (2014-08-16 11:35:33)


Linux is Life

Offline

#5 2014-08-16 14:44:00

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

Ah, the irony... using SimpleScreenRecorder to record a screencast about FFcast.

The SimpleScreenRecorder author may disagree with me, but from the looks of it, the mistake of SimpleScreenRecorder is it tries to wrap ffmpeg and expose only those options it thinks is useful to the user. This was the same mistake I made in FFcast 0.x. I made FFcast 1.0 to fix excatly that. FFmpeg is way too powerful and flexible to be babysit and censored like that. (Update: OK, it doesn't wrap the ffmpeg binary, but uses the library instead. Don't know how much gain you get from doing that.)

I any case, "no publicity is bad publicity", right? Gracias, yoyo308.

@everyone, I have made the release 2.0.0. I'm slightly proud of the result compared to prior versions. Hope you enjoy it. And please read the man page before asking any stupid questions!

Last edited by lolilolicon (2014-08-16 14:48:51)


This silver ladybug at line 28...

Offline

#6 2014-08-16 16:12:01

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here


This silver ladybug at line 28...

Offline

#7 2014-08-16 17:01:36

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,772

Re: FFcast 2.0 is here

lolilolicon wrote:

GIF demontrating a kinky way of using ffcast ...;D

Laddie, you have got to find yourself girl tongue


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2014-08-16 17:38:29

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

When a fella finds a fille, all his kinky ideas go down a blackhole... I'd rather have my way with the git... some binge, some orgy, and some bashing and making... not love (make: *** No rule to make target 'love'.  Stop.)...


This silver ladybug at line 28...

Offline

#9 2014-08-17 21:59:59

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

I wrote a sub-command called 'shot', not intended to be included officially, but it's useful enough for those who like to show off their desktops every month.
It takes a screenshot, and generates also a thumbnail no larger than 250x250, using just ffmpeg,

sub_commands['shot']='take a screenshot, thumbnail included'
sub_cmdfuncs['shot']=subcmd_user_shot
subcmd_user_shot() {
    local outfile=$1 outfile_t
    if [[ -n $1 ]]; then
        outfile=$(format_to_string "${1%.png}.png")
        shift
    else
        outfile=$(printf '%s-%(%Y-%m-%d)T.png' screenshot -1)
    fi
    outfile_t=${outfile%.png}_t.png
    msg 'saving screenshot to file: %s' "$outfile"
    msg 'saving thumbnail to file: %s' "$outfile_t"
    verbose_run command -- \
        ffmpeg -loglevel error -f x11grab -draw_mouse 0 -show_region 1 \
        -video_size "${w}x$h" -i "$DISPLAY+$_x,$_y" \
        -frames:v 1 "$outfile" \
        -frames:v 1 -vf 'scale=min(iw\,min(250\,250*iw/ih)):-1' "$outfile_t"
}

Put that in your ~/.config/ffcast/subcmd, and use it like this,

%  ffcast shot
:: saving screenshot to file: screenshot-2014-08-18.png
:: saving thumbnail to file: screenshot-2014-08-18_t.png

You can add some curl to that function to upload them too.


This silver ladybug at line 28...

Offline

#10 2014-08-19 19:20:16

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

Re: FFcast 2.0 is here

Congrats on using sane ffmpeg commands.

Users can do some additional tweaking to some options for screencasts:

  • "-framerate" if a higher frame rate suits the specific screencast

  • "-preset" if the encoding needs to be faster (such as if it can't keep up to the new -framerate)

  • "-qp 0" if a lossless output is desired (possibly faster encoding, output file may be huge depending on content, artifacts may still be visable due to colorspace conversion)

If audio is also wanted by the user (assuming using ALSA) the ffmpeg command can be modified to do so. See Capturing audio with FFmpeg and ALSA.

Offline

#11 2014-08-20 11:59:43

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

@DrZaius it's been a long time. Good to see you again.

I suppose that is helpful advice regarding ffmpeg. But I think it's worth clarifying, that the "-framerate" option is an input option, while "-preset" and "-qp" are options for the libx264 encoder.
Since version 2.0.1, the 'rec' sub-command provided by ffcast does not specify an encoder at all; users may not notice a difference, since for .mkv or .mp4 output filenames, ffmpeg chooses libx264 by default.

I should also point out to all, that also since version 2.0.1 the %d format string is now changed to %D, to avoid conflict with ffmpeg's commonly used %d placeholder.

Last edited by lolilolicon (2014-08-20 15:17:28)


This silver ladybug at line 28...

Offline

#12 2014-08-26 15:54:50

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

I have just released FFcast 2.2.0. The main changes are:

  • The build system has been changed from a single Makefile to using GNU autotools.

  • xrectsel has been split from FFcast, and is now packaged separately.


This silver ladybug at line 28...

Offline

#13 2014-09-05 01:56:01

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

In FFcast 2.4.0, several global variables have been renamed as follows:

rootw -> root_w
rooth -> root_h
w     -> rect_w
h     -> rect_h
_x    -> rect_x
_y    -> rect_y
x_    -> rect_X
y_    -> rect_Y

If you wrote your own sub-commands, you have to replace those variables.
There are also the new array variables rects, heads, regions, and windows that you can utilize.


This silver ladybug at line 28...

Offline

#14 2016-10-09 07:31:36

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

Hi there.
FFcast gets some updates after two years.

Notable changes since 2.4.1 up to 2.4.6:

New features:

62db4aa rec: add option -r for setting input frame rate
7b0d24c New sub-command 'lag'
a1450f8 New sub-command 'trim'
d489829 trim: add option -f for setting fuzz distance

So try this:

ffcast -sv trim -f 5% lag 2 rec -r 30 -- -v error -t 5 /tmp/a.mp4

Changes:

a30de7e png: use crop filter instead of -video_size

Screenshots of a smaller area used to be noticably slow. This change makes it snappy.
The tradeoff is there's no more show_region for `png`. (If you really want to be notified, use `notify-send` or something?)

Documentation:

4f1d118 Example: take a screenshot of the focused window
f1dadfb Example: trim a rough manual selection
5f3aa05 Example: grab a bunch of windows real quick

There's also the hopefully improved README. Also checkout the Wiki.

Bug fixes:

3c7d743 Use `return` instead of `exit` in functions

For instance, `ffcast -ww each` now correctly prints two lines instead of one.

Last edited by lolilolicon (2016-10-11 08:15:09)


This silver ladybug at line 28...

Offline

#15 2016-10-09 12:25:12

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: FFcast 2.0 is here

Hey lolilolicon,

would you like me to move this thread to "Community Contributions"? I feel it is more suitable there.

Offline

#16 2016-10-09 12:33:56

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

Sure, go ahead smile


This silver ladybug at line 28...

Offline

#17 2016-10-14 13:52:32

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

More updates.

Notable changes introduced in 2.4.7:

bcbad5a Allow region width & height to be zero

Notable changes introduced in 2.4.8:

2c58cba pad: add short variables for geometry parameters
181f0c2 rec: don't set default -framerate
2f5540c New sub-command 'move'

Examples enabled by the new changes:

Click anywhere on screen, and take a screenshot of the upper-left region centered around this point:

ffcast -s pad 'y x' png /tmp/a.png

Open an sxiv window, at the same size as & 10 pixels to the right of the clicked window:

sxiv -g $(ffcast -w move w+10) /tmp/a.png

Last edited by lolilolicon (2016-10-14 13:52:55)


This silver ladybug at line 28...

Offline

#18 2016-10-21 11:13:38

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: FFcast 2.0 is here

lolilolicon wrote:

Open an sxiv window, at the same size as & 10 pixels to the right of the clicked window:

sxiv -g $(ffcast -w move w+10) /tmp/a.png

This didn't work properly with 2.4.8, since the geometry is cropped to the portion that is on screen.
Fixed in 2.5.0.

There's also a new sub-command `abs` introduced in 2.5.0, see commit 2ae5453.

Finally, the console messages should be more helpful now if you use `-v` or `-vv`.
For example, the active region geometry is always reported when changed.

Last edited by lolilolicon (2016-10-21 11:48:18)


This silver ladybug at line 28...

Offline

Board footer

Powered by FluxBB