i.MX 6 gstreamer v4l2jpegdec with v4l2h264enc

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX 6 gstreamer v4l2jpegdec with v4l2h264enc

1,206 Views
Gerbaum
Contributor I

Hi,

I'm using an i.MX6 quad on a Gateworks board.

My problem is, that I try to get a MPJEG stream from a USB camera, decode it, encode it to h264 and set up RTSP Server on Top.


What's the best way to do it? RAW stream from USB camera would work, but cause of USB limitiation the fps (3) at 1080p is too low.

My ideas:

gst-launch-1.0 v4l2src -v device=/dev/video13 ! image/jpeg,width=1920,height=1080,framerate=30/1 ! v4l2jpegdec ! fakesink
Working with low CPU load


gst-launch-1.0 v4l2src -v device=/dev/video13 ! image/jpeg,width=1920,height=1080,framerate=30/1 ! v4l2jpegdec ! v4l2h264enc ! fakesink
ERROR v4l2videodec gstv4l2videodec.c:751:gst_v4l2_video_dec_handle_frame:<v4l2jpegdec0> not negotiated
I guess that's because V4l2h264enc needs NV12


gst-launch-1.0 v4l2src -v device=/dev/video13 ! image/jpeg,width=1920,height=1080,framerate=30/1,colorimetry=bt709 ! v4l2jpegdec ! v4l2convert ! fakesink
Works, low CPU and no lost frames


gst-launch-1.0 v4l2src -v device=/dev/video13 ! image/jpeg,width=1920,height=1080,framerate=30/1,colorimetry=bt709 ! v4l2jpegdec ! v4l2convert ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,colorimetry=bt709 ! v4l2h264enc ! fakesink

ERROR v4l2allocator gstv4l2allocator.c:740:gst_v4l2_allocator_start:<v4l2h264enc0:pool:src:allocator> error requesting 4 buffers: Cannot allocate memory
ERROR v4l2bufferpool gstv4l2bufferpool.c:909:gst_v4l2_buffer_pool_start:<v4l2h264enc0:pool:src> we received 1 buffer from device '/dev/video8', we want at least 2
ERROR bufferpool gstbufferpool.c:559:gst_buffer_pool_set_active:<v4l2h264enc0:pool:src> start failed
Maybe I'm using too much of my Coda960 pipes?


gst-launch-1.0 v4l2src -v device=/dev/video13 ! image/jpeg,width=1920,height=1080,framerate=30/1,colorimetry=bt709 ! v4l2jpegdec ! videoconvert ! x264enc ! fakesink
Works, but maxes out CPU and loses too much frames


gst-launch-1.0 v4l2src -v device=/dev/video13 ! image/jpeg,width=1920,height=1080,framerate=30/1,colorimetry=bt709 ! v4l2jpegdec ! v4l2convert ! x264enc ! fakesink
Work, but again way and too much CPU and lost frames

Any idea?

Is it possible to V4l2jpegdec to NV12? So I could skip v4l2convert...

What's the best way to limit FPS? Maybe I could work with 15 fps...

Thx

0 Kudos
2 Replies

1,198 Views
igorpadykov
NXP Employee
NXP Employee

Hi Gerbaum

 

for Gateworks board one can look at gateworks gstreamer tutorials:

http://trac.gateworks.com/wiki/Yocto/gstreamer

 

>What's the best way to limit FPS?

 

one can look at multimedia examples described in i.MX Linux User’s Guide​

https://www.nxp.com/design/software/embedded-software/i-mx-software/embedded-linux-for-i-mx-applicat...

 

Best regards
igor

0 Kudos

1,196 Views
Gerbaum
Contributor I

Thanks.

I'm running actual 5.4 Mainline Kernel with ubuntu prebuilt, because of up to date 4G modem drivers, so Yocto is not possible for me. That's why imxv4l2 is not available for me.

There are Gateworks gstreamer wikis which show use of v4l2 but they don't show my individual problem of connecting v4l2jpegdec with v4l2h264enc.

 

 

0 Kudos