Tu Tran,
You don't mention what board you have, but I'm going to guess its a
Gateworks GW5400 with digital HDMI video in on /dev/video0 and Analog CVBS
in on /dev/video1. In this case if you inspect capabilities of /dev/video0
via 'v4l2-ctl --deviceo=/dev/video1 --all' you will see that the only video
capture size available is 720x480 (NTSC video) (You say 640x480 but I
assume you mean 720x480).
Therefore you need to scale the video at some point in your pipeline and in
your case you would want to do that before it enters the encoder element
because it appears your intention is to create a 1280x800 H264 encoded
video. Note that you would likely be way better off encoding the image at
its native resolution and up-scaling it while playing it back as otherwise
your just using up bits on up-scaled video.
You are on the right track by using a capsfilter however your pipeline is
telling the source plugin to capture at 1280x800 which it quite simply
can't do. You need to place something in between the source element and the
encoder that is capable of image scaling and in the case of the IMX6 you
would want to use hardware-scaling provided by either the IMX6 ipu
(imxipuvideotransform), the IMX6 GPU (imxg2dvideotransform), or the IMX6
PXP (imxpxpvideotransform). Your best bet is likely imxipuvideotransform as
it supports the video format needed by the VPU encoders. Note also that if
you specify any parameter that can't be met you will get the infamous
'could not link' elements error. It's best to provide only the parameters
you absolutely need and let Gstreamer try to figure out the rest and if you
run into issues start removing features from your capsfilter until you get
a successful pipeline.
If you remove the 'interlaced=false' and 'framerate=10/1' which the
imxv4l2videosrc element doesn't support you can capture successfully:
gst-launch-1.0 imxv4l2videosrc device=/dev/video1 ! videorate !
imxipuvideotransform ! 'video/x-raw, format=(string)I420, width=(int)1280,
height=(int)800' ! imxvpuenc_h264 bitrate=10000 ! filesink
location=/tmp/file.mp4
Although the 'imxipuvideotransform' can't de-interlace via a caps-filter a
'gst-inspect-1.0 imxipuvideotransform' tells you that it indeed can
de-interlace for you by setting the 'deinterlace' property on the element.
Thus you can get closer to your original capsfilter via:
gst-launch-1.0 imxv4l2videosrc device=/dev/video1 ! videorate !
imxipuvideotransform deinterlace=true ! 'video/x-raw, format=(string)I420,
width=(int)1280, height=(int)800' ! imxvpuenc_h264 bitrate=10000 ! filesink
location=/tmp/file.mp4
Because imxv4l2videosrc does not appear to allow framerate adjustments, you
can do this via the standard gstreamer 'videorate' element but do note this
may cause some timestamp/playback issues with the h264 encoder:
gst-launch-1.0 imxv4l2videosrc device=/dev/video1 ! imxipuvideotransform !
'video/x-raw, format=(string)I420, width=(int)1280, height=(int)800' !
videorate ! 'video/x-raw, framerate=10/1' ! imxvpuenc_h264 bitrate=10000 !
filesink location=/tmp/file.mp4
For more information on the gstreamer-imx plugins you can refer to:
- http://trac.gateworks.com/wiki/Yocto/gstreamer/video - examples and
descriptions
- https://github.com/Freescale/gstreamer-imx sourcecode
Regards,
Tim
Tim Harvey - Principal Software Engineer
Gateworks Corporation - http://www.gateworks.com/
3026 S. Higuera St. San Luis Obispo CA 93401
805-781-2000
On Tue, Mar 15, 2016 at 4:05 AM, tutran <admin@community.freescale.com>