lavrec(1)
β¨ lavrec(1) β the MJPEG tools manual, but make it fashion β¨
okay bestie, sit down, hydrate, because we're about to talk about lavrec from the MJPEG tools manual and honestly? she's iconic. π
πΈ NAME πΈ
lavrec β record MJPEG-video from a zoran/video4linux-device π₯β¨
π¦ SYNOPSIS π¦
lavrec [options] filename(s)
π DESCRIPTION π
so like, lavrec is THE girl for recording video in MJPEG format β either quicktime or AVI, dealer's choice π β straight off a zoran video-capture device. we're talking the Miro/Pinnacle DC10(+), the Iomega Buz, Linux Media Labs' LML33... the whole squad. π
and if you don't have one of those? no worries bestie, she also works with a generic video4linux device, like those cheap Bt848 or Bt878 based TV-cards that are literally being sold in every computer shop around the corner. not me gatekeeping nothing, she's for everyone fr fr. π«Ά
β¨ OPTIONS β¨
lavrec accepts the following options:
filenameβ the file you're recording to (*.avi,*.qt). use a%if you wanna record to multiple files β likefile%02d.aviwill record tofile00.avi,file01.avi, etc. you can also just give more than one filename, which does the exact same thing. this is the move to dodge problems from filetype or filesystem size limits, because AVI for example has a 2 GB limit, and so does ext2fs in 2.2.x kernels. π--software-encodingβ by default,lavreccaptures in a mode that's only suitable for recording from hardware MJPEG devices. this option makes her use software-JPEG-encoding (via libjpeg) which unlocks MJPEG-video-capture from tons of generic video4linux devices (like the Bt848/Bt878-based ones). π--software-encoding-yuvpβ this one adds support for the EM28XX USB driver, which is V4L2. the original BTTV software implementation assumes the driver supports V4L, so it will NOT work with the EM28XX driver β not even with the V4L1 emulation layer, sorry babe π. this option enables two things:- it enables the V4L2 calls so interaction with this driver is actually possible
- it selects the card's YUV Packed format and converts it in software to YUV Planar after that, the process is the same as for the BTTV driver. some things of note: the EM28XX driver expects 48KHz audio recording. if you pick something slower it'll still work, but a lot of deleted/inserted frames will occur, and the lower the sample rate, the worse it gets. so recording at 48KHz is recommended. this code was tested and found working with a DVC100 Pinnacle Dazzle. it should work with any EM28XX, but that hasn't been tested. it might work for any other V4L2 device that outputs YUV packed format β also not tested. feedback would be appreciated! π₯Ί
-f/--format [a|A|q|m]β the format the video gets saved to the harddisk in:aβ MJPEG AVIAβ MJPEG AVI with fields exchangedqβ Quicktime by default,lavrecpeeks at the extension of the first file (*.avi,*.qt) and picks a format based on that. π
-i/--input [p|P|n|N|s|S|t|T|f|a]
or
-i/--input input[:norm]β the recording source AND the video source standard format:pβ PAL through Composite or 1st Bt8x8 inputPβ PAL through SVHS- or 2nd Bt8x8 inputtβ PAL through TV-tuner- or 3rd Bt8x8 inputnβ NTSC through Composite or 1st Bt8x8 inputNβ NTSC through SVHS- or 2nd Bt8x8 inputTβ NTSC through TV-tuner- or 3rd Bt8x8 inputsβ SECAM through Composite or 1st Bt8x8 inputSβ SECAM through SVHS- or 2nd Bt8x8 inputfβ SECAM through TV-tuner- or 3rd Bt8x8 inputaβ (or literally every other letter) Autosense (default) the input can be specified with either single letters or an input number with an optional norm, where the number is the n'th input of the card, ranging from 1 to 10. using a numerical input is necessary when you're using input four or higher on a card that has more than three inputs β for instance the AverMedia 6 Eyes π. when using numeric input with the norm, it must contain the whole norm name; valid names arepal,ntscandsecam. you can use numeric input selection on cards with only three inputs too, which is what most Zoran based cards have."-i 2:pal"used with a Buz would be equivalent to"-i P", recording from the S-Video input in PAL format. slay.
-d/--decimation numβ recording decimation, either1,2or4. this decimates the size of the recorded video horizontally AND vertically. want different horizontal and vertical decimations? use two numbers, first one is horizontal, second one is vertical (-d 12). π Note: this option can only be used during hardware recording.-g/--geometry WxH(+X+Y)β for hardware recording: an X-style geometry string giving the geometry of the undecimated subframe to record. the default is the full frame, so720x576/480+0+0for Buz/LML33-users and640x480+0+0or768x576+0+0for DC10(+)-users. for software recording: the size of the video to be captured. currently, width and height need to be a multiple of 16. you always capture the full frame since most video4linux devices donΒ΄t support subframe capture. π€·βοΈ-q/--quality numβ quality of the JPEG-video being recorded (in percent). must be a number between 0 and 100. lower quality should generally mean lower filesize; higher quality takes more diskspace but gives more detailed perfectness in the resulting recorded video. default is50%. πΈ-C/--channel LIST:CHANβ choose the channel to record from (xawtv-style). by default,lavrecjust uses the current TV channel. πΊ-t/--time numβ recording time in seconds. default is unlimited. to stop capturing video while recording, hitCtrl-C. β±οΈ-S/--single-frameβ single-frame capture mode. this means you can capture individual frames from the capture device. πΌοΈ-T/--time-lapse numβ time-lapse factor, meaning only every <num>th frame gets saved to the recording file. β³-w/--waitβ if this option is given,lavrecwaits for the user to press enter before starting to record. β-B/--batchβ this turns off all possible interactivity options and limits console output as much as possible. super useful for cron/scheduled recordings. π€-a/--audio-bitsize numβ audio size in bits, either0,8or16(default).0means no audio. π-r/--audio-bitrate numβ audio sampling rate in Hz. this must be a sampling rate supported by the soundcard. often-supported values are11025,22050or44100(default). π΅-s/--stereoβ capture in stereo. by default,lavreccaptures in mono. π§-l/--audio-volume numβ recording level. must be a value between0(no sound) and100(loud recording).-1(default) means to not touch the mixer settings at all. π-m/--muteβ mute sound output while recording. useful when recording sound from the microphone to disable echos. this option is disabled by default. π€«-R/--audio-source [l|m|c]β recording source, either(l)ine-in,(m)icrophone or(c)d-rom. the default is to record from line-in (l). ποΈ-U/--use-readβ use theread()system call rather than themmap()system call for audio recording. this may fix many audio recording problems. π§-c/--synchronization [0|1|2]β audio/video synchronization level efforts.(0)means no synchronization,(1)meanslavrecwill replicate frames for lost frames, and(2)means she'll replicate frames for lost frames AND do sync correction. default is2. π§©-n/--mjpeg-buffers numβ number of MJPEG-buffers. default is32. try changing this number if you have many lost frames. ποΈ-b/--mjpeg-buffer-size numβ MJPEG buffersize in kilobytes. default is256 kB. π¦--max-file-size numβ the maximum file size per JPEG file. by default,lavrecuses the maximum possible size for that specific recording format. π--max-file-frames numβ the maximum number of frames per JPEG file. by default, the number of frames is only limited by other factors, such as maximum file size. π’--file-flush numβ flush the file to disk after every num frames captured. πΎ-v/--verbose numβ verbosity level (0,1or2). default is0. π£οΈ
πΏ ENVIRONMENT πΏ
the following environment variables can be recognized by lavrec:
LAV_VIDEO_DEVβ the video device. default is/dev/videoLAV_AUDIO_DEVβ the audio device. default is/dev/dspLAV_MIXER_DEVβ the mixer device. default is/dev/mixer
π OUTPUT π
lavrec will output the current recording state. typically it looks like this:
0.06.14:22 int: 00040 lst:0 ins:0 del:0 ae:0 td1=0.014 td2=0.029
let's break it down bestie, because this line is lowkey a whole moodboard:
- the first part is the time that has been spent recording (hours - minutes - seconds - frames)
intis the interval (in milliseconds) between two captured frames β this should be around40for PAL/SECAM and33for NTSClstis the number of lost framesinsanddelare the number of frames inserted and deleted for sync correctionaeis the number of audio errorstd1andtd2are the audio/video time-difference (out-of-sync'ness)
π¬ TYPICAL RECORDING SESSIONS π¬
okay so that's a LOT of options. now how would you normally record video? let's say you wanna record at VCD resolution (352x288) from a PAL source. you might want some higher quality than default (80%). you use default audio options and record to an AVI file. that having been said, your recording command line would look like:
From hardware MJPEG devices (S-video input)
lavrec --format=a --input=P --quality=80 --decimation=2 /path/to/file.avi
From normal video4linux devices
lavrec --software-encoding --format=a --input=p --quality=80 --geometry=352x288 /path/to/file.avi
π BUGS π
lavrecshould be able to detect automatically whether to use software JPEG encoding or whether to use the card's hardware JPEG encoding features (if available). she currently does not, so. yeah. π- besides that, software JPEG encoding seems, for some people, to cause small out-of-sync'ness. SMP support for JPEG encoding is currently work-in-progress. π§
lavrecuses OSS for recording the audio. ALSA emulates OSS, and that can cause problems with the kernel of th 4.x.x series. so we recommend using an older kernel. there are currently no plans to convert the audio to native ALSA. β οΈ
lowkey a warning bestie: that OSS/ALSA situation with 4.x.x kernels is real, so if audio is acting up, that's your suspect. π΅οΈβοΈ
β¨ AUTHOR β¨
ok so this absolute legend wrote the man page you're literally reading right now: Ronald Bultje. say thank you bestie π
and if you've got questions, remarks, problems, or you just wanna slide into the devs' DMs β the main mailing list for the MJPEG-tools is right here:
mjpeg-users@lists.sourceforge.net
for more info, our website is giving main character energy at:
http://mjpeg.sourceforge.net/
π SEE ALSO π
mjpegtools(1)β the whole squad π«Άlavplay(1)β the playback bestie, lavrec's other half π
ok that's the whole page, you're officially a lavrec girlie now π this iconic little manual came from the MJPEG Tools Team and it's dated 27 August 2003, filed under lavrec(1). go forth and record, no cap πβ¨π
π¦ where this page comes from
- arch rolling: mjpegtools 2.2.1-4 Β· GPL-2.0-or-later
- fedora 43: mjpegtools 2.2.1-11.fc43 Β· GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-or-later
- fedora 44: mjpegtools 2.2.1-12.fc44 Β· GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-or-later
- nixos 26.05: mjpegtools 2.2.1
- nixpkgs unstable: mjpegtools 2.2.1
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 Β· GPL-2.0-only
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 Β· GPL-2.0-only
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 Β· GPL-2.0-only
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 Β· GPL-2.0-only
- ubuntu resolute: mjpegtools 1:2.2.1-3
- ubuntu stonking: mjpegtools 1:2.2.1-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms