Newbie Musings, v4l2

Hungerburg pch13 at myzel.net
Sat Jul 12 14:53:19 PDT 2014


It was by accident, that I came to use gstreamer. The experience was at 
times very frustrating. At hands I had a toolkit, yet the manual was 
torn to pieces, many were missing and most were for another version of 
the toolkit that I had chosen (python3 and gtk3).

Now that I have something that works on a single platform, I like to say 
thank you and share some results.

Below two working gst-launch-1.0 pipelines: 1) a prerecorded file that 
gets alpha blended over a live camera feed.

> gst-launch-1.0 \
>   videomixer name=mix sink_1::alpha=0.35 ! xvimagesink sync=false \
>   filesrc location=$V ! decodebin name=demux demux. ! mix.sink_1  \
>   v4l2src force-aspect-ratio=true pixel-aspect-ratio=$R norm=PAL \
>   ! video/x-raw,format=$F,width=$W,height=$H,framerate=25/1 ! mix.sink_0

2) This is the pipeline to record and monitor video for playback:

> gst-launch-1.0 -e \
>   v4l2src force-aspect-ratio=true pixel-aspect-ratio=$R norm=PAL \
>   ! video/x-raw,format=$F,width=$W,height=$H,framerate=25/1 \
>   ! tee name=t_vid ! queue ! xvimagesink sync=false \
>   t_vid. ! queue ! jpegenc ! avimux \
>   ! filesink location=$V

Below parameters work on a bttv based device:

> V=/tmp/movie.avi;F=UYVY;W=768;H=576;R=1/1

Below parameters fail on an stk1160 based device:

> V=/tmp/movie.avi;F=UYVY;W=720;H=576;R=16/15

The recording command will produce an avi that declares PAR twice, the 
v4l2src fails on setup in the mixer command. That my be related. I am 
too tired now to look for the what and why. Curiously, I had it first 
working on that device and then changed the commands to work on the other.

I found the gst-launch tool quite addicting and good to play around 
before laying down code. It looks like it is also good to show concise 
examples for reports. The gst-inspect tool is also great.

> $ gst-launch-1.0 --version
> gst-launch-1.0 version 1.2.4
> GStreamer 1.2.4
> https://launchpad.net/distros/ubuntu/+source/gstreamer1.0

Kind regards

-- 
peter


More information about the gstreamer-devel mailing list