From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id BBA09E0082D; Sun, 28 Dec 2014 08:22:12 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, SPF_HELO_PASS autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.0 SPF_HELO_PASS SPF: HELO matches SPF record * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 HTML_MESSAGE BODY: HTML included in message Received: from ptmx.org (ptmx.org [178.63.28.110]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 5982FE00751 for ; Sun, 28 Dec 2014 08:22:10 -0800 (PST) Received: from [192.168.178.14] (chello062178118086.5.14.vie.surfer.at [62.178.118.86]) by ptmx.org (Postfix) with ESMTPSA id F293D1FD41 for ; Sun, 28 Dec 2014 17:22:08 +0100 (CET) Message-ID: <54A02E31.8030705@pseudoterminal.org> Date: Sun, 28 Dec 2014 17:22:09 +0100 From: Carlos Rafael Giani User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: meta-freescale@yoctoproject.org References: <54A02B08.2060709@pseudoterminal.org> In-Reply-To: <54A02B08.2060709@pseudoterminal.org> Subject: Re: Gstreamer and Transcode i.mx6 X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Dec 2014 16:22:12 -0000 Content-Type: multipart/alternative; boundary="------------070201090902070407010301" --------------070201090902070407010301 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 --------------070201090902070407010301 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit
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
--------------070201090902070407010301--