« sunflow and xsi
» owlside story

paint

paint timelapse

11.27.10 | 3 Comments

.. Or, “how I managed to screencast and convert to PS3 format, a timelapsed painting video using Ubuntu, MyPaint, recordmydesktop, Ffmpeg, yuvfps, named pipes and the internets”.

This post is a bit of a mess. It’s not about the painting, but about the information and commands I found and built to make a timelapse screencast workflow using Ubuntu Linux. I did not innovate any of this workflow; I just record here the commands I found and combined.

I don’t go into much detail about the commands’ components. That’s what google and man are for. I do provide links to my references though.

The painting:
catcopy_paint

The timelapse video:

painting

I wanted to find a way to record a timelapse screen video of my painting sessions. I find that watching back a timelapse paint session can be really informative for showing myself how my brain’s attention flexes and fails while I paint.

I also wanted to watch this stuff on the telly, via a PS3.

the method

I used:
Ubuntu. Easy, easy, easy Linux distro.
MyPaint1 . It’s in the Synaptic package installer. Easy.
recordmydesktop. It’s in the Synaptic package installer. Easy.
Ffmpeg2 . It’s in the Synaptic package installer. Easy.
yuvfps. It’s in the Synaptic package installer, as part of mjpegtools. Easy.
Optionally, a PS3 for viewing. Expensive, but easy. The final MP4 format of video plays fine with VLC in Ubuntu, though.

screen capture

I used recordmydesktop. Ffmpeg can screencapture also.

To make a timelapse video I captured my screen at 0.5 fps (one snapshot every two seconds). I have a 1920×1200 display, and I captured a region at the top left of the screen at resolution 1280×778.

The recordmydesktop command is

recordmydesktop -x 0 -y 0 --width 1280 --height 778 --delay 3 --fps 0.5 -o ~/tmp/screencast/test.ogv

The problem with capturing at 0.5 fps with recordmydesktop is that the output video will also play back at only 0.5 fps. I couldn’t work out how to force recordmydesktop to record at one fps but playback at another. Ffmpeg combined with piping through yuvfps fixes the playback fps.

converting to full framerate and PS3 compatible video

Using ffmpeg and yuvfps I converted the video to 25 fps and a PS3 compatible format all in one command.

The shell command is

ffmpeg -i ~/tmp/screencast/test.ogv -f yuv4mpegpipe - | yuvfps -s 25:1 -r 25:1 | ffmpeg -f yuv4mpegpipe -i - -r 25 -vcodec libx264 -vpre slow -b 15M -mbd rd -flags mv4+aic+qprd+mv0+loop -cmp 2 -subcmp 2 -flags2 dct8x8+skiprd -level 41 -bf 3 -qmin 3 -threads 0 -y ~/movies/output_ps3.mp4

Ffmpeg reads the OGG video, pipes out to the yuvfps tool to change the frames-per-second and then pipes back into ffmpeg to do a final conversion to PS3 video format.

combining more than one recording session

I wanted to combine multiple sessions into a single video file.

Here is a script I used to combine two recorded OGG videos into a single PS3 format MP4, using named pipes3 4 . There is a cool section in the ffmpeg FAQ that shows how to do it (see the links below). My version of the FAQ’s script does not account for audio.

1
2
3
4
5
6
7
8
mkfifo temp1.v
mkfifo temp2.v
mkfifo all.v
ffmpeg -i ../catcopy_paint_01.ogv -an -f yuv4mpegpipe - > temp1.v < /dev/null &
{ ffmpeg -i ../catcopy_paint_02.ogv -an -f yuv4mpegpipe - < /dev/null | tail -n +2 > temp2.v ; } &
cat temp1.v temp2.v > all.v &
ffmpeg -f yuv4mpegpipe -i all.v -f yuv4mpegpipe - | yuvfps -s 25:1 -r 25:1 | ffmpeg -f yuv4mpegpipe -i - -r 23.98 -vcodec libx264 -vpre slow -b 15M -mbd rd -flags >mv4+aic+qprd+mv0+loop -cmp 2 -subcmp 2 -flags2 dct8x8+skiprd -level 41 -bf 3 -qmin 3 -threads 0 -y ./catcopy_paint_01_concat.mp4
rm temp[12].v all.v

watching the video on the PS3

I use MediaTomb to stream media from my Linux box to the PS3 over my network.

finally

I am not an ffmpeg expert, rather, a beginner. If you need help adapting what I’ve written here for your own needs, I will help where I can, but don’t make me lmgtfy. You have been warned!

where I found this information

ffmpeg to PS3, by Francois Lord (with a great breakdown of the ffmpeg comand): http://francoislord.com/blog/everything/encoding-h-264avc-videos-for-ps3-using-ffmpeg_144

concatenating two videos together with ffmpeg (ffmpeg FAQ, section “3.15 How can I join video files?”): http://www.ffmpeg.org/faq.html#SEC27

forcing video framerates with ffmpeg: http://ubuntuforums.org/showthread.php?t=688679

footnotes

  1. MyPaint. This is one of those paint programs that is beautiful in its simplicity. I find it really, really cool for busting out a sketch, but seriously lacking for even moderate working-up of a painting. The most important thing I miss in this package is colour composition modes for its layers and paints (modes like the Potatoshop staples Multiply or Overlay). As a result, I jump in and out of Gimp to do colour mod layers. Hopefully the requests for these features will be answered in time. My favourite brush is “Solid” from the Default set. MyPaint has a bunch of controls for setting the dynamics of the Wacom interactivity. The Solid brush has a cool dual effect of being like a hard-edges smudge tool at low pressures, and a hard edged Guache with slight value variation at high pressures. I thoroughly recommend you try it out! []
  2. Ffmpeg. This is pretty much the most versatile video processing tool you can find. A lot of the GUI-based video conversion tools I’ve used under Winblows and Ubuntu are just GUIs driving an ffmpeg backend. You can find ffmpeg profiles and shell commands for converting videos to almost any specialist media device you can think of. []
  3. named pipes. Using named pipes avoids having to create potentially massive intermediate files during the concatenation process []
  4. My word! I love using footnotes []
Tags: , , ,

3 Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">


« sunflow and xsi
» owlside story