record analog input, crop, deinterlace and save to file

About encoding, codec settings, muxers and filter usage
ecloud
New Cone
New Cone
Posts: 4
Joined: 17 May 2010 23:24

record analog input, crop, deinterlace and save to file

Postby ecloud » 17 May 2010 23:41

I'm trying to archive some old video tapes and laserdiscs.

Here's what I have so far for an analog2theora script:

#!/bin/sh
if [ $# -lt 2 ]
then
echo "Usage: analog2theora out.ogv seconds"
exit
fi
vlc -v "v4l2:///dev/video0:fps=29.97" :v4l2-width=640 :v4l2-height=480 :norm=ntsc :input-slave="alsa://hw:0,0" :v4l2-standard=NTSC :vout-filter=crop :crop-geometry="626x288+10+94" --sout="#transcode{vcodec=theo,vb=800,scale=1,deinterlace=0,acodec=vorb,ab=128,channels=2,samplerate=48000}:standard{access=file,mux=ogg,dst='${1}'}" --run-time=${2} --sout-transcode-fps=30 --sout-transcode-crop-geometry="626x288+10+94"

It's not cropping. But I'm unclear how the pipeline works: do I have to force it to crop before passing it to sout? I tried a bunch of variants to try to do that (put it before sout, after, use the double-dash options or the colon options, ...)

For just cropping and watching the video, this works:

vlc v4l2:// :input-slave="alsa://hw:0,0" --vout-filter=crop --crop-geometry="626x288+10+94"

but how do I get it encoded _after_ being cropped?

My earlier method:

transcode -x v4l2,v4l2 -M 2 -i /dev/video0 -p /dev/dsp -y ffmpeg -F msmpeg4v2 -c 0-${2}:00 -g 640x480 -f 0,4 -I 5 -Q 5 -E 48000,16,2 --lame_preset medium -o ${1}

has suddenly stopped capturing audio; that was after emerge -avuND world (I'm on gentoo), so everything should be up-to-date now and vlc is version 1.0.6. When using transcode instead of vlc, it's not clear how to specify an alsa device for input. It is also not clear now to generate h264 or theora output, which is why I was putting up with mp4 in AVI container. Most of the examples on the web seem to be the vlc --sout variety rather than the direct transcode variety. All very confusing. I've spent several days on this stuff now and still just as lost.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: record analog input, crop, deinterlace and save to file

Postby Jean-Baptiste Kempf » 18 May 2010 00:13

You forgot to insert the crop filter
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

ecloud
New Cone
New Cone
Posts: 4
Joined: 17 May 2010 23:24

Re: record analog input, crop, deinterlace and save to file

Postby ecloud » 18 May 2010 01:31

OK would you please explain where in the command line to do that?

ecloud
New Cone
New Cone
Posts: 4
Joined: 17 May 2010 23:24

Re: record analog input, crop, deinterlace and save to file

Postby ecloud » 12 Jan 2011 06:45

Nobody ever bothered to explain that very well, but after many, many more hours of random experiments I came up with this:

cvlc -v "v4l2:///dev/video0:fps=29.97" :v4l2-width=640 :v4l2-height=480 :norm=ntsc :input-slave="alsa://hw:1,0" :v4l2-standard=NTSC --sout="#transcode{vcodec=h264,deinterlace=1,vfilter=croppadd{cropleft=8,cropright=8},acodec=mp4a,ab=128,channels=2,samplerate=48000}:standard{access=file,dst='${1}'}" --run-time=${2} --sout-transcode-fps=30

which takes video input from /dev/video0 (bttv v4l device) and audio from the second ALSA device (USB Phono Plus) at 48khz, deinterlaces, and outputs to h.264 format. If I give the filename as file.mov it will be in an mov container, .mkv for matroska and so on.

The analogous way for theora is

cvlc -v "v4l2:///dev/video0:fps=29.97" :v4l2-width=640 :v4l2-height=480 :norm=ntsc :input-slave="alsa://hw:1,0" :v4l2-standard=NTSC :vout-filter=deinterlace --sout="#transcode{vcodec=theo,vb=800,scale=1,deinterlace=0,vfilter=croppadd{cropleft=8,cropright=8},acodec=vorb,ab=128,channels=2,samplerate=48000}:standard{access=file,mux=ogg,dst='${1}'}" --run-time=${2} --sout-transcode-fps=30

These are inside scripts where $1 is the output filename and $2 is the time in seconds to be recorded:

[i7][10:37:40 PM] cat analog2theora
#!/bin/sh
if [ $# -lt 2 ]
then
echo "Usage: analog2theora out.ogv seconds"
exit
fi
v4l2-ctl -s 0
v4l2-ctl --set-ctrl saturation=58626
cvlc -v "v4l2:///dev/video0:fps=29.97" :v4l2-width=640 :v4l2-height=480 :norm=ntsc :input-slave="alsa://hw:1,0" :v4l2-standard=NTSC :vout-filter=deinterlace --sout="#transcode{vcodec=theo,vb=800,scale=1,deinterlace=0,vfilter=croppadd{cropleft=8,cropright=8},acodec=vorb,ab=128,channels=2,samplerate=48000}:standard{access=file,mux=ogg,dst='${1}'}" --run-time=${2} --sout-transcode-fps=30


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 7 guests