Skip to content

Instantly share code, notes, and snippets.

@jdye64
Last active March 27, 2017 15:36
Show Gist options
  • Save jdye64/cfd26d4796b3be2f785b825a7ecce89b to your computer and use it in GitHub Desktop.
Save jdye64/cfd26d4796b3be2f785b825a7ecce89b to your computer and use it in GitHub Desktop.
#!/bin/bash
# Enter the name of the file.
read -p "Enter file name: " filename
# Remove any spaces in the file name.
filename=$(echo "$filename" | sed 's/ /-/g')
# This is for metadata. It will show up in the media player playlist or after clicking Properties (in OS X Info) on the file context menu.
read -p "Enter a description: " details
# The number of minutes that the capture command should be ran. This should be set for the duration of the VHS tape.
read -p "Enter VHS Recording Duration in minutes: " recordDuration
rt="${recordDuration}m"
echo "Recording for: $rt"
# Encode video and stop after $recordDuration minutes.
timeout --foreground $rt cvlc v4l2:///dev/video0 :input-slave=alsa://hw:2 :v4l2-standard=NTSC :live-caching=300 --sout '#transcode{vcodec=mp2v,acodec=mpga,ab=128,channels=2,samplerate=48000,fps=29.97,deinterlace}:std{access=file{no-overwrite},mux=ts,dst='/media/nvr/DisneyMovies/$filename.ts'}'
# Upload recording to S3
aws s3 sync /media/nvr/DisneyMovies s3://vhstapes --storage-class REDUCED_REDUNDANCY
# Convert to libx264 to compress further, add in the metadata comments, and keep CPU usage to 75%.
#ffmpeg -i $HOME/Videos/$filename.ts -s 720x480 -c:v libx264 -preset medium -crf 22 -acodec copy -metadata comment="$details" -threads 3 $HOME/Videos/$filename.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment