Skip to content

Instantly share code, notes, and snippets.

@ericherman
Created December 8, 2020 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericherman/6a5ccffabc59aa6d28ec30fbdcb6f7e5 to your computer and use it in GitHub Desktop.
Save ericherman/6a5ccffabc59aa6d28ec30fbdcb6f7e5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
DEV_VIDEO=v4l2:///dev/video2
# aplay -l
DEV_AUDIO=alsa://hw:3,0
err() {
echo >&2 "ERROR: $*"
exit 1
}
command -v cvlc &>/dev/null || err "cvlc command not found"
VIDFILE="${HOME}/cam_$(date +'%Y.%m.%d_%H.%M.%S')_rec.mp4"
echo $VIDFILE
cvlc ${DEV_VIDEO} \
:input-slave=${DEV_AUDIO} \
--sout="#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}\
:file{dst=${VIDFILE},no-overwrite}" \
--no-sout-all --sout-keep
echo $VIDFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment