Skip to content

Instantly share code, notes, and snippets.

@Skylark95
Last active May 8, 2016 03:14
Show Gist options
  • Save Skylark95/00fc343134b8e30017c02abd77805c97 to your computer and use it in GitHub Desktop.
Save Skylark95/00fc343134b8e30017c02abd77805c97 to your computer and use it in GitHub Desktop.
VHS to DVD Linux - Using VLC and ffmpeg
#!/bin/bash
if [ -z $1 ] || [ -z $2 ]; then
echo "Usage: concatdvd CONCAT_STRING OUTPUT"
echo "Example: concatdvd \"concat:video1.mpg|concat:video2.mpg\" out.mpg"
exit 1
fi
ffmpeg -i $1 -c copy -f dvd $2
#!/bin/bash
while getopts ":s:t:i:" opt; do
case $opt in
s)
STARTTIME=$OPTARG
;;
t)
DURATION=$OPTARG
;;
i)
FILE=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
if [ -z $STARTTIME ] || [ -z $DURATION ] || [ -z $FILE ]; then
echo "Usage: cutdvd -s STARTTIME -t DURATION -i FILE" >&2
exit 1
fi
ffmpeg -i $FILE -vcodec copy -acodec copy -ss $STARTTIME -t $DURATION -f dvd cut_$FILE
#!/bin/bash
while getopts ":s:t:i:" opt; do
case $opt in
s)
STARTTIME=$OPTARG
;;
t)
DURATION=$OPTARG
;;
i)
FILE=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
if [ -z $STARTTIME ] || [ -z $DURATION ] || [ -z $FILE ]; then
echo "Usage: encodedvd -s STARTTIME -t DURATION -i FILE" >&2
exit 1
fi
#-vf pad=720:540:0:30:0x000000,fifo,scale=720:480
ffmpeg -ss $STARTTIME -t $DURATION -i $FILE -ss $STARTTIME -t $DURATION -i $FILE -map 1:1 -map 0:0 -target ntsc-dvd -sn -g 12 -bf 2 -strict 1 -ac 2 -aspect 1.3333333333333333 -s 720x480 -trellis 1 -mbd 2 -b:a 192k -b:v 4000k dvd_$FILE
#!/bin/bash
while getopts ":d:s" opt; do
case $opt in
d)
DURATION=$OPTARG
;;
s)
SHUTDOWN=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
if [ -z $DURATION ]; then
echo "Usage: vhsrecord -d DURATION [-s]" >&2
exit 1
fi
NOW=$(date +%m-%d-%y_%H%M)
vlc v4l2:///dev/video0 :v4l2-standard=NTSC :input-slave=alsa://hw:2,0 :live-caching=300 --stop-time=$DURATION --sout "#transcode{vcodec=mp2v,vb=4096,venc=ffmpeg{keyint=16,strict-rc},scale=1,acodec=a52,ab=192,fps=29.97,channels=2}:duplicate{dst=display,dst=std{access=file,mux=ps,dst=$PWD/vhs_$NOW.mpg}}" vlc://quit
if [ "$SHUTDOWN" = true ]; then
poweroff
fi
#!/bin/bash
vlc v4l2:///dev/video0 :v4l2-standard=NTSC :input-slave=alsa://hw:2,0 :live-caching=300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment