Capturing desktop video with VideoLAN VLC

Camtasia Studio is powerful, feature-packed, probably best to use and best know software for Windows and Mac for capturing what you’re seeing and doing on screen and for creating mentoring videos with professional polish.

I would use it myself and recommend it to anyone, if it price would not simply kill me! Videos and screen captures that comes out of Camtasia are just amazing and fabulous, but they still not worth (in my opinion) paying as much as… three hundred Euro!

That’s how story of capturing screen video with VideoLAN started.

However, before you continue, consider if $300 is really a lot of money for you. By saving it (with this article) you’re slipping yourself into world of hard work, many failed tries, long time wasted and lot of angry screams in the middle of the night. Maybe it isn’t worth doing so?

GUI

First, I’m going to show you, how to capture your screen as presentation video, using “clickable” GUI way.

If you’re in hurry and don’t want to read this long article or like discovering everything yourself, look at many of example YouTube guides (for example this one or this one) and use them as starting points.

Mouse image

VLC by default captures all your mouse movement, only doesn’t display them due to lack of proper mouse cursor image. Fix that, by first getting one of them (for example this or this or search Google Graphic or any other source).

Mouse image used in VLC desktop capture must be transparent — i.e. the only accepted image formats are .gif with transparency turned on or .png with transparency as alpha channel.

Save your mouse cursor to the disk, then drag&drop it to any browser window and read (from URL bar / onibar) protocol notation of path and file name (i.e. file:///C:/mouse.png). Use it as value of screen-mouse-image parameter. I.e. add:

:screen-mouse-image=file:///C:/mouse.png

as caputre parameters. Don’t forget about trailing space to separate parameters.

This is, of course, a fake, a constant image only pretending your real mouse cursor. You’ll see it always and everywhere, no matter, if you’re in the middle of some edit box or if you’re actually seeing a hourglass, while your computer is processing some CPU-consuming task. If you want to capture your real mouse cursor, you need to use more professional software, like Camtasia Studio.

Alternative

There is an alternative approach of selecting File > Open Network Stream... (Ctrl+N) or File > Stream (Ctrl + S) and starting screen capture from this point (more information in this wikihow.com article).

It let’s you look (last step) for execution switches your clickable configuration would result in. You may try to convert these switches to command-line call of VLC (see below). Unfortunately, my execrises proven than many of them are not tranferable to command line, and usually end with error message saying that VLC is unable to parse such input string.

Command-line

VLC is the most complex program, know to me, if we talk about command-line. There are hundreds of switches and they’re wary from version to version. New version of VLC may (will) deprecate many command-line options, switches or approaches. That is why you probably won’t be able to use many examples for VLC 1.x.x in 2.0.6, for which is this guide.

Most command-line examples in the beginning are short enough to run them directly from Start > Run in Windows. As you go deeper into examples and and commands become longer, you may reach Start > Run limit of 260 characters (commands will be broken in the end and VLC won’t execute correctly). In this case, you have to run cmd and execute commands directly there (copy command and paste it using Paste from context menu).

In this case, either navigate to your VLC directory (cd "C:\Program FilesVideoLAN") and use commands starting from vlc.exe or use full path, but given in double quotes ("C:\Program FilesVideoLANvlc.exe screen:// ..."), as in default VLC installation path, there as space in Program Files which will cause cmd command to fail, if you provide full path without double quotes.

Capturing video with command-line VLC

To start VLC from command-line in screen capture mode, execute following in Windows command-line (cmd):

vlc.exe screen:// --screen-fps=10 :sout=#transcode{vcodec=h264,vb=1800,scale=1}:std{access=file,dst=test.mp4}

Correct path, if you installed VLC in other folder or get rid of it at all, if you used cd C:\Program FilesVideoLAN, to navigate to VLC folder before starting it.

This will start VLC in screen capture mode. To stop recording, press Stop button on main VLC window.

This mode is part of streaming function, so data will be written to file on-the-fly as you record your desktop. This is more resource hunger approach, but your file can be at least partially usable, if something interrupts VLC before it ends writing entire file (this does not secures you, however, from VLC crashes, in which case you’ll most likely loose your work).

You’re file will be written right away (see below), in default VLC’s codec — MP4 / MPEG 4. To record your screen in other codec, for example, in WMV2, use following command:

vlc.exe screen:// --screen-fps=10 :sout=#transcode{vcodec=WMV2,vb=1800,scale=1}:std{access=file,mux=asf,dst=output.wmv}

Follow to “Chapter 4. The command line interface” of VLC User Guide, to “Stream Output” section and “Description of the modules — standard (alias std)” subsection, for more information on formats (and proper switches) in which you can write the destination video of your screen capture.

Start minimized

If you execute above example, you’ll see, that though you started VLC from command line, its window is clearly seen on captured video, which is most likey an unwanted effect. To get rid of it, start VLC in minimized mode, by using --qt-start-minimized switch.

With it in command-line, VLC will start mimized to traybar (an icon next to Windows clock). It will also show a ballon with screen:// message, informing you that your command-line was correct and VLC was started in screeen capture mode. There isn’t any (known to me) way of getting rid of this message directly in VLC. And this is good, as without any notice, VLC could be used to slow down your computer, while you would be most likely unaware of this fact.

There isn’t any way of getting rid of this message directly in VLC? Well… there is… You can always crop your capture area. See in the end of this article.

You can leave this small gap in the beginning of your screen capture, if it isn’t a problem for you or cut it of from final video, using nearly every video editing software.

To stop recording your screen capture, click VLC’s traybar icon with right mouse button and select Quit to exit program. To make it faster / easier, configure your taskbar to never hide VLC’s traybar icon. This moment (when you’re selecting VLC’s context menu and closing it) most likely won’t be recorded as a part of your movie, so you won’t have to edit end of your movie, to get rid of it.

FPS

Here are example configurations for different FPS speeds:

vlc.exe screen:// --qt-start-minimized --screen-fps=5 :sout=#transcode{vcodec=h264,vb=1800,scale=1}:std{access=file,dst=test-fps5.mp4}
vlc.exe screen:// --qt-start-minimized --screen-fps=10 :sout=#transcode{vcodec=h264,vb=1800,scale=1}:std{access=file,dst=test-fps10.mp4}
vlc.exe screen:// --qt-start-minimized --screen-fps=24 :sout=#transcode{vcodec=h264,vb=1800,scale=1}:std{access=file,dst=test-fps24.mp4}

For example, test screen capture video (11 seconds long) I’ve got:

  • 5 FPS = 291 kB,
  • 10 FPS = 504 kB,
  • 24 FPS = 1102 kB.

10 seconds seems fine. Recalculate and check for your needs.

Path to destination file

Without path — VLC installation dir, i.e. C:\Program Files\VideoLAN in default Windows installation.

Windows-path (C:\TEMPtest.mp4) is the only officially accepted. I.e.:

vlc.exe screen:// --qt-start-minimized --screen-fps=10 :sout=#transcode{vcodec=h264,vb=1800,scale=1}:std{access=file,dst=C:\TEMP\test.mp4}

You can also use double-slash notation (C:\TEMP\test.mp4), but this is not advised. Protocol notation (file:///TEMP/test.mp4) is prohibited and won’t work.

Mouse image

Use --screen-mouse-image switch and protocol notation path (file:///C:/mouse.png):

vlc.exe screen:// --qt-start-minimized --screen-mouse-image=file:///C:/mouse.png --screen-fps=10 :sout=#transcode{vcodec=h264,vb=1800,scale=1}:std{access=file,dst=C:\TEMPtest.mp4}

Protocol notation is the only accepted format, as of VLC 2.0.6, for specyfing mouse image. All other ways of specyfing paths, you may find in examples for VLC 1.x.x, are now invalid and will result in screen capture without mouse cursor.

Limit area

Let’s admit — recording entire screen on HD 1920×1080 display with high bitrare and frames per seconds count can produce astonishing video guides, but can be painfull on even fastest Internet connections and on even biggest cloud stores / streaming servers. Therefore, it is a good idea to do something to limit resulting file size.

In nine cases of ten you simply don’t need to capture entire screen area. You can crop it or limit it.

If screen block, that you’re presenting on your desktop capture is permanent, you can simply crop your video with vfilter parameter:

vlc.exe screen:// --qt-start-minimized --screen-mouse-image=file:///C:/mouse.png --screen-fps=10 :sout=#transcode{vcodec=h264,vb=1800,scale=1,vfilter=croppadd{cropleft=300,croptop=300,cropright=300,cropbottom=300}}:std{access=file,dst=C:\TEMPtest.mp4}

In this example, 1680×1050 full screen capture was cropped to 1080×450. Cropping 600 pixels in height and width, resulted in reducing 17 second long video from 696 kB to 296 kB, that is — by half.

You can also reduce captured desktop area, by using screen-width and screen-height parameters to pre-fix area to top, left corner of screen.

vlc.exe screen:// --qt-start-minimized --screen-width=500 --screen-height=300 --screen-mouse-image=file:///C:/mouse.png --screen-fps=10 :sout=#transcode{vcodec=h264,vb=1800,scale=1}:std{access=file,dst=C:\TEMPtest.mp4}

This is more usefull, than cropping, as in this mode, you can use additional paramter screen-follow-mouse, which will make VLC capture prefixed area of screen around your mouse pointer. Once you move it, captured “window” will also move:

vlc.exe screen:// --qt-start-minimized --screen-width=500 --screen-height=300 --screen-mouse-image=file:///C:/mouse.png --screen-follow-mouse --screen-fps=10 :sout=#transcode{vcodec=h264,vb=1800,scale=1}:std{access=file,dst=C:\TEMPtest.mp4}

This will capture a “moving region” around your mouse pointer, sized to the dimensions, you’ve provided. Notice, that this (using screen-follow-mouse parameters) can crash VLC in many versions.

Capturing video with sound

Let me start with underlining, that this is a complete new story, not just clicking some buttons or adding some extra switch to command line.

To be honest, I never follow this path. I always:

  • capture no-sound-like screen capture video with VLC,
  • play in (once finished) in VLC, recording my voice with any audio software,
  • mix audio and video streams in Format Factory to get the final product.

Here are some of my attempts to get everything in VLC.

So far, you’ve been using screen:// protocol, a special build-in VLC protocol for capturing video. Highly configurable and flexible, yet still having a large bug, that simply does not allows to capture screen and your voice (or background music) together.

You may try the input-slave switch in command-line:

vlc.exe screen:// --qt-start-minimized --screen-mouse-image=file:///C:/mouse.png --input-slave=file:///C:/audio.mp3 --screen-fps=10 :sout=#transcode{vcodec=h264,vb=1800,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:std{access=file,dst=C:\TEMPtest.mp4}

I failed with it so many time, that I simply give away.

Why you should not record your videos with audio?

Here are most important arguments, why (in my opinion) you should resign from adding audio or speach to your video:

  • with each additional stream (here: audio), your video file becomes larger, even using good compression coded,
  • you have to use DirectShow protocol, instead of screen://, which lacks many options and is accessible only via GUI, not via command-line,
  • if you’re focused on making good visual experience and giving audio decription in the same time, you’re twice more open for making mistakes in either,
  • your video should be self-explanatory; don’t treat your watchers as complete idiots, that must actually hear, that they need to click a button, you’re pointing on screen, etc.

If you really need audio description, record your video (with VLC) in a first pass, make yourself sure, that it is perfect in the way you would like it to be, play it yourself on screen, record audio for it, using any software (even system-bundled) and finally mix audio and video streams together (for example using VLC or any software).

Whether you’re doing mux (mixing audio and video) of your own voice (audio description) or just want to add cool background music to your video, you may consider Format Factory software. Aside being perfect (yet free) media type converter, it has also option for muxing “hidden” in extra (last) left sidebar pane.

But, can we do it in VLC?

Still not convinced? Sure, we can… But, since it requires using a different protocol, which goes far beyond area of this post, it will be covered only in minimum details.

Follow to Roger’s woze blog, to read about capturing video and audio in the same time, using VLC and DirectShow protocol. Basically, you need one or another DirectShow screen capture filters. Some of them are mentioned in separate Roger’s blog entry.
Roger has even authored his own free and open source plugin, you can grab at SourceForge.net. Download it and install.

In basic, default installation, it lets you record desktop video along with any musing played in the background. You need to use different audio player — for example Windows Media Player — if you have VLC configured to play your music. Using VideoLAN to both play background music and stream it into captured video desktop may end up in empty, unreadable output video file or even whole Universe colapse. Don’t try this at home, OK?

After simply installing plugin, start your VLC and use it like decribled above, in “GUI” section. Leave default DirectShow in Capture mode, instead of changing it into Desktop as usual. Select screen-capture-recorder for Video device name and virtual-audio-capturer as Audio device name. If they’re not appearing, hit Refresh list or restart VLC. Click on Advanced options to change other parameters, for example video aspect rate (which in default is set to 4:3). Follow other steps unchanged.

Recording this way will record your desktop with any background audio being played (that you can here through speakers or headphones).

If you want to record desktop video with your own voice, you have to re-configure your audio card to make it able to capture wave-out. Roger’s blog gives you details on how to do this in Windows XP. If you’re on Windows 7 then:

  • right-click volume control icon next to your system clock and select Recordind devices,
  • select your microphone and click on Properties button,
  • switch to Hearing tab and mark Listening to this device checkbox,
  • if you can hear, whatever your speaking to your microphone, then all is fine.

Now, you can record video from your desktop with your own audio description.

Final words

Wow, that was long one! :] And surely I didn’t plan this article turn out to be soooo long, when I sit down to write it.

And to tell you even more, this is just an tip of iceberg, what you should know or what VLC can do about screen capture with it. So, belive me or not, if you still not willing to spend that three hundred bucks for Camtasia Studio, there’s a lot of learning still before you.

And remember… “Chapter 4. The command line interface” is always your good friend! :] Though, soon you’re going to scream, next time you’ll see it…

Leave a Reply