Created
December 13, 2021 06:49
-
-
Save nanawel/0028c6ada3f606a9f6f35485a4273dca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# record_vlc.sh | |
# Nanawel 2014 | |
# https://lanterne-rouge.info/2014/01/num%C3%A9risation-de-vhs-sous-linux | |
echo "====== VHS Record (VLC) ======" | |
VIDEO_DEV="/dev/video0" | |
SOUND_DEV="alsa://hw:2,0" | |
NORM="SECAM_LC" | |
OUTPUT=$(dirname $0)/record_$(date +%s).mpg | |
VCODEC="mp1v" # Video codec | |
ACODEC="mpga" # Audio codec | |
VB="1024" # Video bitrate | |
AB="192" # Audio bitrate | |
BIN="cvlc -v" | |
if [ ! -z $1 ]; then | |
RT=$(($1*60)) | |
ENDPOS_OPT=":run-time=$RT" | |
else | |
ENDPOS_OPT="" | |
fi | |
PLAYBACK_CMD="$BIN v4l2://$VIDEO_DEV :v4l2-standard=$NORM :input-slave=$SOUND_DEV :live-caching=300 $ENDPOS_OPT" | |
TRANSCODE_OPTIONS=":sout=#transcode{vcodec=$VCODEC,acodec=$ACODEC,vb=$VB,ab=$AB}:standard{access=file,dst=$OUTPUT}" | |
CMD="$PLAYBACK_CMD $TRANSCODE_OPTIONS vlc://quit" | |
# Only playback (for testing purposes) | |
#CMD="vlc v4l2://$VIDEO_DEV :v4l2-standard=$NORM :input-slave=$SOUND_DEV :live-caching=300" | |
echo "====== Command ======" | |
echo $CMD | |
echo | |
echo Press Enter to confirm or Ctrl-C to abort | |
read | |
echo "====== Running ======" | |
$CMD 2>&1 | tee $OUTPUT.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment