cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
678 Views
Registered: ‎10-03-2018

SDI Video to NV12_10LE32 HEVC MPEG

Hello Folks,

I just submit a service request for this, and I thought that I would ask you all as well. 

My problem is that I want to capture SDI video and encode as 10-bit, 4:2:0 using HEVC compression. 

I need to adjust the variable "SCALE_SRC" to a format compatible with 10-bit, 4:2:0 input for "v4l2src". 

Unfortunately I cannot find an appropriate format specification. 

Here is the script, it is also attached as a file:

#!/bin/bash  -v
##
##  xilinx-question.008.2019-1.bash
##    - capture raw SDI to ten-bit 4:2:0 HEVC encode
##


        MEDIA_src='"a0030000.v_smpte_uhdsdi_rx_ss":0 [fmt:UYVY10_1X20/3840x2160 field:none]'
        SCALE_SNK='"a0080000.v_proc_ss":0 [fmt:UYVY10_1X20/3840x2160 field:none]'
        SCALE_src='"a0080000.v_proc_ss":1 [fmt:UYVY10_1X20/3840x2160 field:none]'

        time  \
        xmedia-ctl  --verbose  --device /dev/media0   \
                --set-v4l "${MEDIA_SRC}, ${SCALE_SNK}, ${SCALE_SRC}"


        time  \
        gst-launch-1.0 --gst-debug-level=3 --gst-plugin-spew --messages --verbose --eos-on-shutdown --gst-fatal-warnings  \
            v4l2src device=/dev/video0 io-mode=dmabuf num-buffers=3000  \
            ! capsfilter caps='video/x-raw,format=NV12_10LE32,framerate=50/1,height=2160,width=3840'  \
            ! omxh265enc gop-length=30 gop-mode=basic low-bandwidth=true target-bitrate=100000  \
                                 b-frames=0 num-slices=4 control-rate=variable qp-mode=uniform periodicity-idr=30  \
            ! queue max-size-buffers=5 max-size-bytes=0  \
            ! h265parse  \
            ! qtmux  \
            ! capsfilter caps='video/quicktime'  \
            ! filesink location=UYVY10_1X20.TBD.NV12_10LE32.format-test.002.12G.h265.2019-1.mp4

##
##--end of file
##

I believe that the problem lies with xmedia-ctl, in that the version in the 2019.1 distribution does not have an appropriate format specifier available. 

I have looked at the Xilinx device driver, and there appears to be a suitable media-bus format for 10-bit 4:2:0 video. 

Here is a link to the 10-bit 4:2:2 solution: SDI Video to 10 Bit H265 MPEG

Help and guidance are appreciated. 

Kind Regards,
Peimann, S. M.
----
Toddlers are the Storm-Troopers of the Great God Entropy.
Physics: Not Just a Good Idea, It's THE LAW.
Tags (2)
0 Kudos
Reply
2 Replies
Highlighted
Moderator
Moderator
553 Views
Registered: ‎04-24-2017

Hi @peimann ,

Sorry for the late reply. 

Here is the right format for 4:2:0 10-bit which is fixed in 2019.1 SDI Rx driver https://github.com/Xilinx/linux-xlnx/commit/a2c1ff4535ce69122d9217ea88d92738eb9c6b57

AFAIK very less equipments supports 4:2:0 10-bit make sure you have the right source to generate this.

root@zcu106_vcu_trd:/media/card# xmedia-ctl -d /dev/media0 -V "\"a0080000.v_proc_ss\":0 [fmt:VYYUYY10_4X20/3840x2160 field:none]"
root@zcu106_vcu_trd:/media/card# xmedia-ctl -d /dev/media0 -V "\"a0080000.v_proc_ss\":1 [fmt:VYYUYY10_4X20/3840x2160 field:none]"
root@zcu106_vcu_trd:/media/card# xmedia-ctl -p -d /dev/media0
root@zcu106_vcu_trd:/media/card# gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! video/x-raw, format=NV12_10LE32, width=3840, height=2160, framerate=60/1 ! omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 target-bitrate=60000 num-slices=8 control-rate=constant prefetch-buffer=true low-bandwidth=false filler-data=true latency-mode=normal ! h265parse ! queue max-size-bytes=0 ! mpegtsmux name=mux ! filesink location = "/media/card/vcu-sdirx-cap.mp4"
Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
Highlighted
Explorer
Explorer
524 Views
Registered: ‎10-03-2018


Hello @sandeepg,

Thanks for the input.

Unfortunately, from what I understand, 4k SDI is 4:2:2, 10-bit in the specification.  The 4:2:0 is an extension of some sort. 

Unfortunately, all of my available test equipment is incapable of 4:2:0. 

May I ask what you are using for a front-end signal generator? 

As with my previous tests, on the 2019.1 vcu_sdrx build, using a 4k, 4:2:2, 10-bit SDI input and trying to rescale to 4:2:0, 10-bit results in an insufficient resources error, with subsequent failure of the pipe-line. 

As follows:

root@zcu106_vcu_trd:/media/card# ./xilinx-question.008.vcu_sdirx.2019-1.bash
+ xmedia-ctl -d /dev/media0 -V '"a0080000.v_proc_ss":0 [fmt:VYYUYY10_4X20/3840x2160 field:none]'
+ xmedia-ctl -d /dev/media0 -V '"a0080000.v_proc_ss":1 [fmt:VYYUYY10_4X20/3840x2160 field:none]'
+ xmedia-ctl -p -d /dev/media0
Media controller API version 4.19.0

Media device information
------------------------
driver          xilinx-video
model           Xilinx Video Composite Device
serial
bus info
hw revision     0x0
driver version  4.19.0

Device topology
- entity 1: vcap_sdi output 0 (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "a0080000.v_proc_ss":1 [ENABLED]

- entity 5: a0030000.v_smpte_uhdsdi_rx_ss (1 pad, 1 link)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Source
                [fmt:UYVY10_1X20/3840x2160@1000/60000 field:none]
                -> "a0080000.v_proc_ss":0 [ENABLED]

- entity 7: a0080000.v_proc_ss (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Sink
                [fmt:VYYUYY10_4X20/3840x2160 field:none]
                <- "a0030000.v_smpte_uhdsdi_rx_ss":0 [ENABLED]
        pad1: Source
                [fmt:VYYUYY10_4X20/3840x2160 field:none]
                -> "vcap_sdi output 0":0 [ENABLED]

+ gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 '!' video/x-raw, format=NV12_10LE32, width=3840, height=2160, framerate=60/1 '!' omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 target-bitrate=60000 num-slices=8 control-rate=constant prefetch-buffer=true low-bandwidth=false filler-data=true latency-mode=normal '!' h265parse '!' queue max-size-bytes=0 '!' mpegtsmux name=mux '!' filesink location = /media/card/vcu-sdirx-cap.mp4

** (gst-launch-1.0:2853): WARNING **: 09:05:22.757: Property 'latency-mode' is deprecated and have no effect. Use a caps filter with 'alignment' field set to 'au' for normal latency and 'nal' for subframe latency (e.g.  ... ! omxh264enc ! video/x-h264,alignment=nal ! ...).
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
../../../git/sys/v4l2/gstv4l2src.c(697): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:00.078065430
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
root@zcu106_vcu_trd:/media/card#

My script file is as follows:

#!/bin/bash -x
##
##  xilinx-question.008.vcu_sdirx.2019-1.bash
##    - as recommended by Sandeep
##

  xmedia-ctl -d /dev/media0 -V "\"a0080000.v_proc_ss\":0 [fmt:VYYUYY10_4X20/3840x2160 field:none]"

  xmedia-ctl -d /dev/media0 -V "\"a0080000.v_proc_ss\":1 [fmt:VYYUYY10_4X20/3840x2160 field:none]"

  xmedia-ctl -p -d /dev/media0

  gst-launch-1.0                                                                                \
    v4l2src device=/dev/video0 io-mode=4                                                        \
      ! video/x-raw, format=NV12_10LE32, width=3840, height=2160, framerate=60/1                \
      ! omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 target-bitrate=60000    \
                   num-slices=8 control-rate=constant prefetch-buffer=true low-bandwidth=false  \
                   filler-data=true latency-mode=normal                                         \
      ! h265parse                                                                               \
      ! queue max-size-bytes=0                                                                  \
      ! mpegtsmux name=mux                                                                      \
      ! filesink location = "/media/card/vcu-sdirx-cap.mp4"                                     \
      ##<end>


##
##--end of file
##

 

NB: Updated post to insert top paragraphs, which were inadvertently deleted. 

Kind Regards,
Peimann, S. M.
----
Toddlers are the Storm-Troopers of the Great God Entropy.
Physics: Not Just a Good Idea, It's THE LAW.
0 Kudos
Reply