Skip to content

Instantly share code, notes, and snippets.

@coreymwamba
Last active April 15, 2020 02:28
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 coreymwamba/39132aa65f473051ffc1163564318cc4 to your computer and use it in GitHub Desktop.
Save coreymwamba/39132aa65f473051ffc1163564318cc4 to your computer and use it in GitHub Desktop.
Records from a camera, and takes audio from a soundcard connected in JACK. Edit variables to taste.
#! env /bin/bash
# ffpmeg-jack-AV-rec - record video from a webcam, audio from a soundcard, using FFMpeg in JACK.
# Corey Mwamba 2018
# You will need jack_autoconnect (https://github.com/kripton/jack_autoconnect)
# And FFMpeg. And JACK.
# the -thread_queue_size option for ffmpeg reduces xruns
FR=25
VC=h264
AC=aac
VN=$(date +%s)
VE=mp4
RES=1280x720
jack_autoconnect "system:capture_1" "ffmpeg_rec:input_1" "system:capture_2" "ffmpeg_rec:input_2" &
ffmpeg -thread_queue_size 2048 -f jack -i ffmpeg_rec -ac 2 -f v4l2 -framerate $FR -i /dev/video0 -s $RES -vcodec $VC -acodec $AC $VN.$VE
kill $(pidof jack_autoconnect)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment