Skip to content

Instantly share code, notes, and snippets.

@ghadishayban
Created November 5, 2012 14:43
Show Gist options
  • Save ghadishayban/4017515 to your computer and use it in GitHub Desktop.
Save ghadishayban/4017515 to your computer and use it in GitHub Desktop.
Rip an old VHS using avconv and video4linux2
#!/bin/bash
# expects filename as first arg
# Using jack highly recommended over alsa
# Make sure you set up real time priorities
pasuspender -- qjackctl &
echo Before pressing play, go into the jack GUI and \
connect the source to the sink.
# I have a shitty K-world em28xx USB adapter
# This makes sure it complies
# sets the adapter to use the second channel,
# which is component video, 1st is S-Video
v4l2-ctl -i 1
# set to NTSC (or PAL if you want)
v4l2-ctl -s ntsc
# force resolution
v4l2-ctl -v width=640,height=480,pixelformat=YUYV
avconv \
-channel 1 \
-f video4linux2 \
-i /dev/video0 \
-f jack \
-i convertvid \
-c:v libx264 \
-pre:v superfast \
-b:v 800000 \
-r:v 25 \
-threads:v 4 \
-filter:v crop=636:432:4:0,yadif \
-c:a libmp3lame \
-b:a 256k \
${1}.mp4
# the cropping filter is optional, yadif is recommended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment