Skip to content

Instantly share code, notes, and snippets.

@noah
Last active January 25, 2020 06:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noah/78f76bbb5845a65400d60fbb65c56a23 to your computer and use it in GitHub Desktop.
Save noah/78f76bbb5845a65400d60fbb65c56a23 to your computer and use it in GitHub Desktop.
VCR transcoding - usbtv007
# ツ sudo lsusb|grep -i easy
# Bus 001 Device 007: ID 1b71:3002 Fushicai USBTV007 Video Grabber [EasyCAP]
# usbtv module on archlinux
# fushicai usbtv007
# ultimately, mencoder works. also tried mplayer and ffmpeg but on-the-fly transcoding doesn't work. mplayer can't save tv "streams", so mencoder is necessary.
# audio transcode o-t-f is fast enough but just copy video and transcode it later
# tradeoff: 1GB/1minute of video, roughly
mencoder -tv driver=v4l2:norm=NTSC:width=720:height=480:outfmt=uyvy:device=/dev/video1:adevice=hw.2,0:alsa=true:immediatemode=0:amode=1:audiorate=48000:forceaudio=true:buffersize=600 -vf yadif=1 tv:// -o stream.ts -oac mp3lame -lameopts cbr -ovc copy
# mplayer -tv driver=v4l2:norm=NTSC:width=720:height=576:outfmt=uyvy:device=/dev/video1:alsa:adevice=hw.2,0:immediatemode=0:amode=1:audiorate=48000:forceaudio -aspect 16:9 -ao alsa -vo x11 tv://
# "-dumpstream does not work for every input, it cannot work for tv." -- https://lists.mplayerhq.hu/pipermail/mplayer-users/2012-December/085683.html
# ffmpeg -vsync 1 -video_size 720x480 -rtbufsize 300000k -i /dev/video1 -thread_queue_size 1024 -f alsa -i hw:2 -thread_queue_size 1024 -vf "fps=29.97,yadif=0:0:0,hqdn3d=3,drawbox=y=ih-h:w=0:h=6:t=max,format=yuv420p" -maxrate 1750k -bufsize 3500k
# -crf 23 -preset medium -tune film -c:a aac -b:a 96k -c:v libx264 -pix_fmt yuv420p -movflags +faststart
# -r 30 output.mp4
# also useful:
# ツ arecord -l
# v4l2-ctl -V
# v4l2-ctl --list-formats-ext -d /dev/video0
#
#
#
# using gstreamer and other tools might work but much more complicated/overwrought (see, e.g., https://linuxtv.org/wiki/index.php/V4L_capturing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment