From ArchWiki
Jump to navigation Jump to search

Get dimensions (pixels location) of the window that you want to capture, for screen-casting remote desktop , screen recording Desktop capture screen-capture with:



sleep 5 && ffmpeg -f alsa -ac 1 -i pulse -f x11grab -r 10 -s 1024x720 -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 output-file1.mkv

If Pulse audio is super-ceding ALSA, try:

-i hw:0


-i 'hw:1,0'

If top-left bound (corner) of the window (area / region) that you want captured/recorded is not 0,0 (top-most edge of display server Desktop, then add:

-i :0.0+62,168

to specify the left and top co-ordinate locations of the top-left of the window.

TIP: Disable your screen saver. That -will- interfere with the video that is captured. This is not semantic, instead it captures pixels (raster).

Download ffmpeg for Windows (daily/nightly build):


When using Microsoft's OS (NT-based) , as opposed to a Unix or unix-like flavour OS distribution (e.g. BSDs or GNU/Linux),

..\..\..\ffmpeg.zeranoe.com__builds\bin\ffmpeg -f dshow -framerate 10 -video_device_number 0 -i video="screen-capture-recorder" -f dshow -audio_device_number 0 -i audio="Headset Microphone (Logitech US" -filter_complex amix=inputs=1 -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -vsync vfr -acodec pcm_s16le ouput-video-filename_produced-by-running-this-command-line.mkv

The off-set that I successfully used with an X11 GNU/Linux -based system didn't work , as well as "-s" switch for x and y width and height of capture region area (co-ordinates).

Break that command-line down, to help better understand it (and how to tweak it, for your individual case):

ffmpeg (binary executable)

  • next specifies the INPUT
    • video (visual , raster, pixels)
      • -f dshow
      • -i video="screen capture-recorder" (alternately, this value can , instead, be "gdigrab" G.D.I. [1] But, in my experience, this created a lag (latency mis-synchronisation between audio and video content/streams, in which the video lagged behind the audio) (upon playback)
      • additional options (modifiers): -video_device_number 0 and (optionally, specify (explicitly) the frame-rate) -framerate 10 for 10 fps (frames-per-second) (do NOT use the "-r" switch for this!)
    • audio
      • -f show (you start off this component of the command line with that string of -f dhow
      • -i audio="Headset Microphone (Logitech US" (Apparently no closing perentesis character at end, enclosed with that pair of double-quotation marks ? )
      • -audio_device_number 0
      • -filter_complex amix=inputs=1 (set that last integer value to '2' if you specify more than one simultaneous input device. Further note, If I specify more than one audio input source to record from, simultaneously, the "screen-capture-recorder" is not available (I get an error from ffmpeg) and instead I can only use "gdigrab" for recording desktop, under those conditions (more than one audio input).
  • next, OUTPUT (keep in mind that certain options that were specified in the input stage component of the command line invocation of ffmpeg, can be independently controlled for the output. E.g. a given region of the source display can be chosen for input into ffmpeg, but another region (taken from what the input stream provides) can be chosen to be encoded in output/product result file).
    • video
      • -vcodec libx264 (in this case, using the open-source H.264 encoding library, that is linked to the ffmpeg binary executable
      • -pix_fmt yuv240p (I read that this ensures maximum playback compatibility for most systems of the file that ffmpeg will create here.
      • (additional options for the encoding) -preset ultrafast
      • -vsync vfr
    • audio
      • -acodec pcm_s16le
  • The last argument (value that is plugged in(to) the command line is the location within the filesystem hierarchy tree of where to store (save) (spit out) the output that ffmpeg generates. This is usually a file on a mounted filesystem volume. At the minimum, specify a(ny arbitrary combination of characters / text string (given that the filesystem supports it, oh, and the command interpreter supports it and doesn't mangle "expand" interpret it, as well)) filename -- and the filename suffix/extension does matter to ffmpeg. It cannot be arbitrary. It's not like any combination of characters to the right of the right-most period (dot character) in the filename value (string) is okay. FFmpeg cares about it because it will determine which kind of container file format to house the outputting video and audio streams within.

software solution download

"c:\Program Files\Screen Capturer Recorder\configuration_setup_utility\vendor\ffmpeg\bin\ffmpeg.exe" -f dshow -i audio="VIA HD Audio Input":video="screen-capture-recorder" -s 352x288 -r 20 -t 20 mobile-resolution-screen-capture.mp4

- source: this posting, on this thread.

The software program that offers that is called Screen Capturer Recorder.
Free binaries (installer packages) :

First use:

ffmpeg -list_devices true -f dshow -i dummy


search for: ffmpeg f gdigrab

GDI grab

ffmpeg.exe -f dshow -f gdigrab -i desktop -framerate 15 -video_size 1100x800 -f dshow -audio_device_number 0 -i audio="Headset Microphone (Logitech US" -f dshow -i audio="virtual-audio-capturer" -filter_complex amix=inputs=2 -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -vsync vfr -acodec pcm_s16le new-output-video-file.mkv

N.B. "-video size" doesn't seem to work for me. It captures entire Desktop display output, anyway.

Also, I managed to combine audio from two sources -- make sure value given to "amix=inputs=" is not '1' (In this case , particularly, it is '2'). Recording from 2 simultaneous audio inputs is possible with : "-filter_complex amix=inputs=2"

another example

c:Downloads\ffmpeg.zeranoe.com__builds\bin\ffmpeg -f dshow -f gdigrab -i desktop -framerate 15 -video_size 1100x800 -f dshow -audio_device_number 0 -i audio="Headset Microphone (Logitech US" -f dshow -i audio="virtual-audio-capturer" filter_complex amix=inputs=2 -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -vsync vfr -acodec pcm_s16le muxed-video-file.mkv

ffmpeg.exe -f dshow -framerate 30 -i video="screen-capture-recorder":audio="virtual-audio-capturer" -filter_complex amix=inputs=1 -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -acodec pcm_s16le "output result file.mkv"

preceed (in .bat file, maybe?) with timeout /t 3 command. (The timeout command [2] is available for Windows 6.x (Vista, "7" and "8").

more references

"Capture Windows screen with ffmpeg" posting

ffmpeg -f dshow -i video="UScreenCapture":audio="Realtek AC97 Audio" -vf crop=xwidth:xheight:xleft:xtop c:\output.flv

"Stream your Windows desktop using ffmpeg" Posted on 10:26, November 3rd, 2011 by Many Ayromlou

ffmpeg -f dshow -i video="UScreenCapture" -r 30 -vcodec mpeg4 -q 12 -f mpegts udp://aaa.bbb.ccc.ddd:6666?pkt_size=188?buffer_size=65535

or, gdigrab



recordmydesktop -width 1024 -height 720 -o $filename.720.1Mbps.ogv -delay $time -freq 44100 -channels 1 -fps 15 -s_quality 10 -v_bitrate 1000000

Extract the audio ((bit)stream) from inside of a container file that consists of muxed (multi-plexed) audio + video, together (integrated):

(pwd / location in local filesystem)(Command-line prompt)e:\Users\Public\Downloads\ffmpeg.zeranoe.com__builds\bin\ffmpeg -i "videofile.720.mp4" -vn -acodec copy aac-audio.m4a

in a nutshell...

$ > ffmpeg -i -acodec copy audio-only.file

(explanation of) the schemea / formula of the above, concrete example (of a ) command line:

at command-prompt: $ (binary of ffmpeg executable / or "command", if in "path" env. variable of command-line shell environment) -i (path to source / input file that will be altered in some way, in this case, the audio content will be extracted from * ) any additional switches (telling ffmpeg what to do with the input / how to process it) and, the last value/argument is the destination/target/output file that is newly-created <-- that contains the result, the effect consequence of this operation (invoking/running the command line).

  • btw, the way ffmpeg works, no alteration is made to the source/input file. That file is not edited in-place (ever!?). What ffmpeg does, is it produces output from that source file which it treats read-only. At minimum, given access to a correct source file, it will output information about that file (its metadata overhead, and what compression algorithm format each media stream is encoded in.) In addition, optionally, a new file will be created, acccording to whatever options parameters conditions are specified (in the forms of switches, arguments, values). Operation

When using mkisofs don't forget to include "ERRCTL="WARN|ALL *" in the command line. Otherwise, if mkiso encounters a warning and certainly any errors, it will stop abort. uugh. Overcome that default beahvior by including that.

RIP 13.7 has all of the optical disc open-source software listed below, except libcdio ("cd-info", in particular).

libCDio from GNU

offers (at least one) tool that can query (report) stats status state of optical media (CD-Rs, DVD+Rs)

libcdio-utils: sample applications based on the CDIO libraries

    This package contains a collection of small libcdio-based tools:
     * cd-drive show CD-ROM drive characteristics
     * cd-info show information about a CD or CD-image
     * cd-paranoia an audio CD ripper
     * cd-read read information from a CD or CD-image
     * cdda-player a simple curses-based audio CD player
     * iso-info show information about an ISO 9660 image
     * iso-read read portions of an ISO 9660 image
     * mmc-tool issue low-level commands to a CD drive


which, in turn [3]

cd-info may need --dvd switch for DVD R media, of course. (never cd-rs, I assume)

cd-info --dvd

cd-info --dvd --iso9660


isoinfo -d -i /mnt/image/2014may7.iso

is like cd-info's --iso9660 switch. (well a combination of that and ...)

isoinfo -f -i /mnt/image/2014may7.iso

to either role/mode/command (report '-d' primary volume Descriptor (info head about volume as a whole) or list (find) "-l" contents (all files and folders)) -- optionally add switches "-J" for Joliet and -R for RockRidge extensions to / layers of the ISO 9660 volume.

others include

cdrwtool -d -i


cdrecord ... -minfo , -msinfo , -toc switches (and maybe -atip)

cdrdao disk-info and cdrdao msinfo


xorriso -devices

xorriso -indev /dev/sr0 -pvd_info

"pvd" stands for Primary Volume Descriptor, which reports information (metadata) about the ISO 9660 filesystem volume. That filesystem volume comprises the contents of a given, individual data track that resides on the optical medium (disc). The Primary Volume Descriptor is located (resides) in/at the beginning/top of that filesystem volume (data track / bitstream).

xorriso -indev /dev/sr0 -toc

"toc" is (stands for) Table of Contents, which is the overhead for the disc, overall / as a whole. The optical disc (medium)'s T.O.C. can be thought of as the equivalent to what a partition table is on/for other types of block storage devices, like USB flash drives, Solid State Drives, Hard Disc Drives (HDDs). The point here is, (the information that / what is reported/returned/output by that above command serves as information/data about the sessions (and tracks) on the disc (the overall layout structure of the contents of the disc).


Compact Disc Digital Audio -> .wav (windows RIFF? container file, which contains/houses PCM audio samples (content / bistream).)

This app/program/utility is used for audio "ripping" or extraction

Apparently cdda2wav is capable of providing some data about data CD-Rs (and DVD Rs too?) too -- not just audio CDs.

-J --info-only switch.

Its cdrkit equivalent (sister app) is called : icedax (which stands for: the Incredible Digital Audio Extractor).

Linux mount

Also try mounting the filesystem storage volume on the disc

mount -t iso9660 -o norock,nojoliet -o noatime,uid=1000,gid=100 /dev/sr0 /mnt/image/

optionally add options like "session" to choose which session (if more than one session(track) is on the disc).

The "nojliet" and "norock" mount optiosn instruct the mount command to NOT mount the RockRidge and Joliet extensions/layers to ISO9660.



ImgBurn has Read and Verify modes. It gives details stats figures

except what Windows Explorer gives (which corresponds to cdrecord -minfo (msinfo mode too?) for "Free:" free/unallocated space (capacity)

see /generate-optical-filesystems (ISO9660 and its optional extensions like Joliet and Rockridge and UDF)


according to the description of the software it may use DVD Info Pro for the stats functionality (aspect).