lavrec(1)

πŸ“¦
version 2.2.1 Β· 2 versions
, in arch rolling, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu resolute, ubuntu stonking

✨ 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 β€” like file%02d.avi will record to file00.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, lavrec captures 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 AVI
    • A β€” MJPEG AVI with fields exchanged
    • q β€” Quicktime by default, lavrec peeks 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 input
    • P β€” PAL through SVHS- or 2nd Bt8x8 input
    • t β€” PAL through TV-tuner- or 3rd Bt8x8 input
    • n β€” NTSC through Composite or 1st Bt8x8 input
    • N β€” NTSC through SVHS- or 2nd Bt8x8 input
    • T β€” NTSC through TV-tuner- or 3rd Bt8x8 input
    • s β€” SECAM through Composite or 1st Bt8x8 input
    • S β€” SECAM through SVHS- or 2nd Bt8x8 input
    • f β€” SECAM through TV-tuner- or 3rd Bt8x8 input
    • a β€” (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 are pal, ntsc and secam. 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, either 1, 2 or 4. 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, so 720x576/480+0+0 for Buz/LML33-users and 640x480+0+0 or 768x576+0+0 for 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 is 50%. πŸ“Έ
  • -C/--channel LIST:CHAN β€” choose the channel to record from (xawtv-style). by default, lavrec just uses the current TV channel. πŸ“Ί
  • -t/--time num β€” recording time in seconds. default is unlimited. to stop capturing video while recording, hit Ctrl-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, lavrec waits 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, either 0, 8 or 16 (default). 0 means no audio. πŸ”‡
  • -r/--audio-bitrate num β€” audio sampling rate in Hz. this must be a sampling rate supported by the soundcard. often-supported values are 11025, 22050 or 44100 (default). 🎡
  • -s/--stereo β€” capture in stereo. by default, lavrec captures in mono. 🎧
  • -l/--audio-volume num β€” recording level. must be a value between 0 (no sound) and 100 (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 the read() system call rather than the mmap() 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) means lavrec will replicate frames for lost frames, and (2) means she'll replicate frames for lost frames AND do sync correction. default is 2. 🧩
  • -n/--mjpeg-buffers num β€” number of MJPEG-buffers. default is 32. try changing this number if you have many lost frames. πŸ—‚οΈ
  • -b/--mjpeg-buffer-size num β€” MJPEG buffersize in kilobytes. default is 256 kB. πŸ“¦
  • --max-file-size num β€” the maximum file size per JPEG file. by default, lavrec uses 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, 1 or 2). default is 0. πŸ—£οΈ

🌿 ENVIRONMENT 🌿

the following environment variables can be recognized by lavrec:

  • LAV_VIDEO_DEV β€” the video device. default is /dev/video
  • LAV_AUDIO_DEV β€” the audio device. default is /dev/dsp
  • LAV_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)
  • int is the interval (in milliseconds) between two captured frames β€” this should be around 40 for PAL/SECAM and 33 for NTSC
  • lst is the number of lost frames
  • ins and del are the number of frames inserted and deleted for sync correction
  • ae is the number of audio errors
  • td1 and td2 are 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 πŸ’€

  • lavrec should 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. 🚧
  • lavrec uses 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 πŸ’–βœ¨πŸŽ€