Choppy v4l2/bttv capture

Omkiran Sharma omkiran.for.wiki at gmail.com
Mon Dec 26 03:09:29 PST 2011


Hi,
>
> Been looking at converting VHS tapes into nice open digital media,
> using GStreamer naturally. However I'm having problems getting smooth
> recordings.
>
> I'm doing this on a Dual core Intel 3.06GHz with 4GB RAM running Fedora
> 16 (64bit) and using a Hauppauge Win/TV pci, Brooktree Corporation
> Bt878 Video Capture card.
>
> Using tvtime to watch videos works fine and I can capture video (and
> audio) using mencoder with the following:
>
> mencoder tv:// -tv driver=v4l2:device=/dev/video1:alsa:adevice=hw.1,1 -oac
> copy  -ovc lavc -o video.avi
>
> and playback of the resultant video is smooth.
>
>
> However, I just can't get smooth video with GStreamer.
>
> E.g, using the following:
>
> gst-launch oggmux name=mux ! filesink location=vid.ogv v4l2src
> device=/dev/video1 ! videorate !
> video/x-raw-yuv,width=320,height=240,framerate=25/1 ! ffmpegcolorspace !
> queue ! theoraenc bitrate=800 ! queue ! mux. alsasrc buffer-time=100000
> device=hw:1,1 ! audio/x-raw-int,channels=1,rate=119466 ! audioconvert !
> queue ! vorbisenc ! mux.
>
> Works in as much as I get a Ogg Theora file that plays back and bits
> where there isn't a lot of movement look fine, however, scenes with a
> lot of (or not even that much) motion become choppy.
>
> Note: The above command was cobbled together by a lot of scouring the
> internet and trial and error. So I wouldn't be surprised if it's wrong
> in various ways.
>


Hi Andrew,
 I do not think it is a v4l2 problem. theoraenc plugins by default drops
frames when the bitrate is not enough.
For a quick test why don't you increase your bitrate to say 5000 (just for
a test of one file) and see if it still drops the frames. 5Mbps is waay to
much for a 320x240 video sequence and hence if it was the encoder dropping
it because bitrate wasn't enough you know you have found the problem.
eg.
gst-launch oggmux name=mux ! filesink location=vid.ogv v4l2src
device=/dev/video1 ! videorate !
video/x-raw-yuv,width=320,height=240,framerate=25/1 ! ffmpegcolorspace !
queue ! theoraenc bitrate=5000 ! queue ! mux. alsasrc buffer-time=100000
device=hw:1,1 ! audio/x-raw-int,channels=1,rate=119466 ! audioconvert !
queue ! vorbisenc ! mux.


The solution is to set the property "drop-frames" to  false in theoraenc]
gst-launch oggmux name=mux ! filesink location=vid.ogv v4l2src
device=/dev/video1 ! videorate !
video/x-raw-yuv,width=320,height=240,framerate=25/1 ! ffmpegcolorspace !
queue ! theoraenc bitrate=800 *drop-frames=0* ! queue ! mux. alsasrc
buffer-time=100000 device=hw:1,1 ! audio/x-raw-int,channels=1,rate=119466 !
audioconvert ! queue ! vorbisenc ! mux.

This will reduce quality at the high motion frames but not drop them all
together.
To get best possible quality at that rate, I suggest you first capture as a
YUV and then encode it using two passes. However it might not be an option
if you do not have the disk space etc or for other reasons in which case
the above should work.



>
> Any idea's would be appreciated.
>
> Cheers,
> Andrew
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20111226/f0390ffb/attachment.htm>


More information about the gstreamer-devel mailing list