On 2014-12-28 17:08, Carlos Rafael Giani wrote:
On 2014-12-28 14:31, Peter Hafner wrote:
Hi,
I want to trans code 2 different types of streams to h264 codec, on a i.mx6 Dual.
First  stream is from a STK1160 video device
and I'm using this gstreamer commands.

gst-launch-1.0 --gst-debug=3 v4l2src device=/dev/video0 ! videoconvert ! imxvpuenc_h264 bitrate=4096 ! "video/x-h264,stream-format=byte-stream,profile=high" ! h264parse ! matroskamux name=mux ! filesink location=output.FIFO -v

This is working !

The second stream, is a raw jpeg stream via udp.
This is the commands, I currently thought it is the best one:
gst-launch-1.0 --gst-debug=3 udpsrc buffer-size=1000000 port=5006 ! queue !  jpegdec ! videoconvert ! imxvpuenc_h264 bitrate=4096 ! "video/x-h264,stream-format=byte-stream,profile=high" ! h264parse ! matroskamux name=mux ! autovideosink

I got always the error "reason not-negotited (-4). Of course tested a lot.

This is working with video test src:
#gst-launch-1.0 videotestsrc !  videoconvert ! imxvpuenc_h264 bitrate=4096 ! "video/x-h264,stream-format=byte-stream,profile=high" ! h264parse ! matroskamux name=mux ! filesink location=output.FIFO -v &
 
Thanks Peter



With udpsrc, you need to define the caps for the output data explicitely. Check out the "caps" property of udpsrc.

Furthermore, you can replace jpegdec with imxvpudec (it can decode motion JPEG). Once you do that, you can remove videoconvert from the pipeline, since imxvpudec outputs I420-formatted pixels, which imxvpuenc_h264 can use directly.

Also, as a general advice, always try to use one of the transform elements instead of videoconvert. The imx(g2d,ipu,pxp)videotransform elements use hardware accelerated conversions, while videoconvert does conversions with the CPU (and by default also does dithering, which is even slower).



I just noticed another problem: the "video/x-h264,stream-format=byte-stream,profile=high" caps filter. You cannot use that, since the VPU encoder only supports the baseline profile. If that is ok, then simply remove this capsfilter.

Example pipeline:

gst-launch-1.0 --gst-debug=3 udpsrc buffer-size=1000000 port=5006 caps="image/jpeg" ! queue !  imxvpudec ! imxvpuenc_h264 bitrate=4096 ! h264parse ! matroskamux name=mux ! autovideosink