screencast instructions

Christian Lohmaier lohmaier+libreoffice at
Fri Nov 30 05:16:03 PST 2012

Hi Noel, *,

On Thu, Nov 29, 2012 at 5:36 PM, Noel Power <nopower at> wrote:
> I was asked by a number of people about how I created

I might be missing something - but a spreadsheet document is not a
screencast video...

> and in particular the captions/subtitles.
> [...]
> I used recordmydesktop ( available from all good linux distros ), my
> commandline was something like
>    recordmydesktop  --v_bitrate  2000000 -o zoom.ogv ( cntrl-c when finished
> and it will dump the .ogv file )

with gnome3 one ould use the builtin gstreamer-pipeline with
<ctrl>+<alt>+<shift>+r to record the desktop, if you want more
control, something like this:

Alternatively capturing "manually" one can use lossless encodings:

ffmpeg -loglevel warning -f x11grab -r 15 -s ${WIDTH}x$HEIGHT -i
:0.0+$POS_X,$POS_Y -f yuv4mpegpipe -pix_fmt yuv420p - | x264 --demuxer
y4m --preset veryfast --qp 0 -o output.mkv -

x264's lossless mode is quite effective for screencasts. get
dimensions and position of the window to record with "xwininfo -frame"
or just grab the whole area and cut afterwards..

the ffmpeg options explained:
"-loglevel warning" just be more quiet
"-f x11grab" capture the screen
"-r 15" with a framerate of 15 fps (feel free to use bigger values)
"-s ${WIDHT}x$HEIGHT" capture an area that is that large
"-i :0.0+$POS_X,$POS_Y" the "source" for the x11grab is on Display
:0.0 and starts at offset $POS_X,$POS_Y
"-f yuv4mpegpipe" the output format is yuv4mpeg
"-pix_fmt yuv420p" convert from the X-Servers RGB colorspace to yuv for h264
"-" output to stdout for piping into the encoder

the x264 options explained:
"--demuxer y4m" what is fed on stdin is yuv4mpeg
"--preset veryfast" use the veryfast preset - tradeoffs encoding speed
vs filesize, but as we're generating lossless video, we can use a
slower preset afterwards for the final result - just make sure you use
a preset that is fast enough for real-time encoding.
"--qp 0" switch to lossless mode
"-o output.mkv" write to file output.mkv
"-" and read from stdin

> for me the high bit rate "--v_bitrate  2000000" was necessary to smoothly
> capture mouse movements,

Strange that the bitrate has impact - should have been the framerate..
But with low bitrate the image gets "muddy", so maybe that's what you
meant. Then again: Using a lossless format doesn't have this problems.
Capture lossless, then convert to whatever other target format would
be my suggestion.

> [...]
> so.. onto the subtitles lots of google hits make me try 'aegisub' but this
> was a waste of time for me, just didn't work,

Works excellent for me :-) - but may need a little time to get used to
on how to define when a subtitle should be displayed (in other words
on how to do timing)

> So, basically with subtitles you can either
> deliver them with a separate file ( the .srt file previously mentioned or
> there apparently is another popular caption/subtitle format '.ass' - I kid
> you not!!! )

ASS is "*A*dvanced *S*ub*S*tation alpha" format. And that's the format
of choice if you want to use any kind of effects (text fade in/out,
text rotation, shearing, drawing objects, etc)

> [...] I wanted to actually have the
> subtitles encoded in the video stream itself and the only way I found to do
> that which worked ( to actually re-encode subtitles into the video stream )
> was to use mencoder. [...]
>    mencoder zoom.ogv -o output-zoom.avi  -ovc lavc -lavcopts acodec=ac3 -oac
> mp3lame -sub -lavcopts vbitrate=2400

As you mentioned, you're pointlessly converting to lossy formats.
I suggest to use mplayer and pipe into the actual encoder (or use
ffmpeg, that is the "throw whatever you like at it" solution)

mplayer -nosound -benchmark -vo yuv4mpeg:file=>(x264 --demuxer y4m
--crf 20 --output output.mkv - 2>/tmp/x264.log) input.mkv

Options explained:
"-nosound" don't output any sound
"-benchmark" ignore the framerate, but decode frames as-fast-as-possible
"-vo yuv4mpeg:file=>(.....)" output to yuv4mpeg and pipe the output to
the x264 command
"input.mkv" the file to read

x264 option explained:
"--crf 20" instead of using lossless mode, use constant-quality mode
with a factor of 20 (lower values=better quality, but larger files, it
doesn't make sense to go lower than 18)

But you don't have to use x264 of course, you can use ffmpeg or other
tools in a similar fashion.

My key point is to not use a chain of lossless conversions, but only
to do the lossless one as last step.

> [...]


More information about the LibreOffice mailing list