cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
399 Views
Registered: ‎08-01-2019

VCU low datarate encoding

Hi;

I use ZCU104 board with Vivado 2019.1 and Petalinux 2019.1.

I aim to encode 1920x1080p @30fps input video with low datarate (500 Kbps  etc.) with Gstreamer. Actually I have reached my goal, but it is not functional.

When I use the pipeline ;

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=1920, height=1080, framerate=30/1 ! videoconvert ! videorate ! omxh265enc control-rate=constant target-bitrate=400 gop-length=30 num-slices=8 gop-mode=0 gdr-mode=0 qp-mode=2 filler-data=true periodicity-idr=-1 initial-delay=100 cpb-size=200 prefetch-buffer=true low-bandwidth=true default-roi-quality=3 skip-frame=true qos=true ! video/x-h265, max-picture-size=15, alignment=au ! h265parse ! mpegtsmux name=mux alignment=7 name=mux ! udpsink host=192.168.1.2 port=5000 max-lateness=-1 qos-dscp=60 sync=false

it's okey. The output stream run around 400~450 Kbps. But, I must to listen the port via VLC before start to stream (because of periodicity-idr is disabled.)

When the periocity-idr is enabled, gstreamer is not working correctly. Generally; it runs the first time but if the gstreamer is stopped and trying to start again with same pipeline (periodicity-idr is enabled) or some other pipeline (that is known to work) gstreamer not run.

The pipeline is;

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=1920, height=1080, framerate=30/1 ! videoconvert ! videorate ! omxh265enc control-rate=constant target-bitrate=400 gop-length=30 num-slices=8 gop-mode=0 gdr-mode=0 qp-mode=2 filler-data=true periodicity-idr=320 initial-delay=100 cpb-size=200 prefetch-buffer=true low-bandwidth=true default-roi-quality=3 skip-frame=true qos=true ! video/x-h265, max-picture-size=15, alignment=au ! h265parse ! mpegtsmux name=mux alignment=7 name=mux ! udpsink host=192.168.1.2 port=5000 max-lateness=-1 qos-dscp=60 sync=false

I tried different periodicity-idr values for the pipeline but every time I encountered the same problem. The error messages after the command;

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
!! Warning : Adapting profile to support bitdepth and chroma mode
!! The specified Level is too low and will be adjusted !!
[  682.769668] al5e a0100000.al5e: Failed on create channel
Failed to create Encoder:
/!\ ERROR:unknown error (128)
[E] [TreatSetStateCommand]: OMX_ErrorUndefined
0:00:05.256476790  6105   0x7f9400a130 ERROR                    omx gstomx.c:875:EventHandler:<omxh265enc-omxh265enc0> encoder got error: Undefined (0x80001001)
0:00:05.256545970  6105   0x558a488a80 ERROR                    omx gstomx.c:363:gst_omx_component_handle_messages:<omxh265enc-omxh265enc0> encoder got error: Undefined (0x80001001)
0:00:05.256590180  6105   0x558a488a80 ERROR                    omx gstomx.c:1409:gst_omx_component_get_state:<omxh265enc-omxh265enc0> encoder got error while waiting for state change: Undefined (0x80001001)
0:00:05.256631400  6105   0x558a488a80 WARN             omxvideoenc gstomxvideoenc.c:3424:gst_omx_video_enc_handle_frame:<omxh265enc-omxh265enc0> error: Failed to enable OMX encoder: Undefined (0x80001001)
0:00:05.256827990  6105   0x558a488a80 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<v4l2src0> error: Internal data stream error.
0:00:05.256860270  6105   0x558a488a80 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<v4l2src0> error: streaming stopped, reason error (-5)
ERROR: from element /GstPipeline:pipeline0/GstOMXH265Enc-omxh265enc:omxh265enc-omxh265enc0: GStreamer encountered a general supporting library error.
Additional debug info:
../../git/omx/gstomxvideoenc.c(3424): gst_omx_video_enc_handle_frame (): /GstPipeline:pipeline0/GstOMXH265Enc-omxh265enc:omxh265enc-omxh265enc0:
Failed to enable OMX encoder: Undefined (0x80001001)
Execution ended after 0:00:05.130850080
Setting pipeline to PAUSED ...
[E] [SetParameter]: OMX_IndexParamPortDefinition: OMX_ErrorIncorrectStateOperation
0:00:05.257082420  6105   0x558a488a80 ERROR                    omx gstomx.c:1564:gst_omx_component_set_parameter:<omxh265enc-omxh265enc0> Set encoder parameter at index 0x02000001: Incorrect state operation (0x80001018)
0:00:05.257141500  6105   0x558a488a80 ERROR                    omx gstomx.c:1743:gst_omx_port_update_port_definition:<omxh265enc-omxh265enc0> Updated encoder port 0 definition: Incorrect state operation (0x80001018)
0:00:05.257181310  6105   0x558a488a80 WARN             omxvideoenc gstomxvideoenc.c:3424:gst_omx_video_enc_handle_frame:<omxh265enc-omxh265enc0> error: Failed to enable OMX encoder: Undefined (0x80001001)
Setting pipeline to READY ...
0:00:05.257286510  6105   0x558a488a80 WARN               mpegtsmux mpegtsmux.c:996:mpegtsmux_create_streams:<mux> error: Could not create handler for stream
0:00:05.257709250  6105   0x558a485b60 ERROR                    omx gstomx.c:1387:gst_omx_component_get_state:<omxh265enc-omxh265enc0> Component encoder in error state: Undefined (0x80001001)
0:00:05.257751210  6105   0x558a485b60 ERROR                    omx gstomx.c:1387:gst_omx_component_get_state:<omxh265enc-omxh265enc0> Component encoder in error state: Undefined (0x80001001)
Setting pipeline to NULL ...
0:00:05.320094760  6105   0x558a485b60 ERROR                    omx gstomx.c:1387:gst_omx_component_get_state:<omxh265enc-omxh265enc0> Component encoder in error state: Undefined (0x80001001)
0:00:05.320153730  6105   0x558a485b60 ERROR                    omx gstomx.c:2491:gst_omx_port_deallocate_buffers_unlocked:<omxh265enc-omxh265enc0> Component encoder in error state: Undefined (0x80001001)
0:00:05.320250570  6105   0x558a485b60 ERROR                    omx gstomx.c:2543:gst_omx_port_deallocate_buffers_unlocked:<omxh265enc-omxh265enc0> Deallocated buffers of encoder port 0: Undefined (0x80001001)
Freeing pipeline ...

 

It doesn't work again until the board rebooted. For the higher datarate, there is no problem.

How can I solve the problem?

 

 

0 Kudos
2 Replies
Highlighted
Moderator
Moderator
250 Views
Registered: ‎04-12-2017

Hello @anlgorgulu 

Apologies for the late reply on this.

Can you clarify certain things:

1.  can you please post media-ctl -d /dev/media0 -p log.

2. When you not used periodicity-idr you said pipeline doesn't work, but you said its functional. but not reaching the goal; what do you mean by this?

3. For the second pipeline, can you keep periodicity-IDR value in the multiples of your GOP length and FPS? please share the results.

Regards

Kunal

 

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Highlighted
Visitor
Visitor
231 Views
Registered: ‎08-01-2019

Hello @kvasantr ;

Thanks for reply. 

1- Log of "media-ctl -d /dev/media0 -p" is

 

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_hdmi output 0 (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "b0040000.v_proc_ss":1 [ENABLED]

- entity 5: b0040000.v_proc_ss (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:Y8_1X8/1280x720 field:none colorspace:srgb]
                <- "a0030000.v_hdmi_rx_ss":0 [ENABLED]
        pad1: Source
                [fmt:Y8_1X8/1920x1080 field:none colorspace:srgb]
                -> "vcap_hdmi output 0":0 [ENABLED]

- entity 8: a0030000.v_hdmi_rx_ss (1 pad, 1 link)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Source
                [fmt:RBG888_1X24/1920x1080 field:none colorspace:srgb]
                [dv.caps:BT.656/1120 min:0x0@25000000 max:4096x2160@297000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
                [dv.detect:BT.656/1120 1920x1080p30 (2200x1125) stds:CEA-861 flags:CE-video]
                -> "b0040000.v_proc_ss":0 [ENABLED]
				
				

 

 

2- When I not used the periodicity-IDR; pipeline works. But it is not functional; because of I must listen to port before start the streaming. When I start to listen the port with VLC and after that the streaming is started; VLC plays it.

Regardless of when streaming was started; whenever VLC starts to listen the port, the incoming stream should be able to be played on VLC.

When the stream is started before open the VLC, VLC could not play the incoming stream. VLC needs IDR to identify incoming streaming. It is the debug messages of VLC in this case;

ts debug: pid[65] unknown
ts debug: first packet for pid=65 cc=0xa
ts debug: first packet for pid=0 cc=0xb
ts debug: PATCallBack called
ts debug: new PAT ts_id=1 version=0 current_next=1
ts debug: * number=1 pid=32
ts debug: temporary receiving program 1
ts debug: first packet for pid=32 cc=0xb
ts debug: PMTCallBack called for program 1
ts debug: new PMT program number=1 version=0 pid_pcr=65
ts debug: * PMT descriptor: Registration (0x5)
ts debug: : HDMV registration
ts debug: * PMT descriptor: Unknown Private (0x88)
ts debug: * pid=65 type=0x24 ISO/IEC Reserved
ts debug: => pid 65 has now es fcc=hevc
main debug: selecting program id=1
main debug: looking for packetizer module matching "any": 25 candidates
main debug: using packetizer module "hevc"
main debug: looking for video decoder module matching "any": 19 candidates
avcodec debug: using ffmpeg Lavc58.6.103
avcodec debug: CPU flags: 0x000fd3db
avcodec debug: allowing 5 thread(s) for decoding
avcodec debug: codec (hevc) started
avcodec debug: using frame thread mode with 5 threads
main debug: using video decoder module "avcodec"
ts debug: Default program is 1
ts debug: enabling pid 65 from program 1
ts debug: enabling pcr pid 65 from program 1
ts debug: first packet for pid=65 cc=0xc




3-  For the pipeline the fps=30 and gop-lenght=30; (I also tried periodicit-idr values of 30/60/90/180/270/300)

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=1920, height=1080, framerate=30/1 ! videoconvert ! videorate ! omxh265enc control-rate=constant target-bitrate=400 gop-length=30 periodicity-idr=270 num-slices=8 gop-mode=0 gdr-mode=0 qp-mode=2 filler-data=true initial-delay=100 cpb-size=200 prefetch-buffer=true low-bandwidth=true default-roi-quality=3 skip-frame=true qos=true ! video/x-h265, max-picture-size=15, alignment=au ! h265parse ! mpegtsmux name=mux alignment=7 name=mux ! udpsink host=192.168.1.32 port=50000 max-lateness=-1 qos-dscp=60 sync=false --gst-debug-level=3

At the first time; the pipeline works well. But, if the streaming is stopped and after that I use the same pipeline, it not works.

The debug messages is;

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
!! Warning : Adapting profile to support bitdepth and chroma mode
!! The specified Level is too low and will be adjusted !!
[ 1628.433705] al5e a0100000.al5e: Failed on create channel
Failed to create Encoder:
/!\ ERROR:unknown error (128)
[E] [TreatSetStateCommand]: OMX_ErrorUndefined
0:00:05.468428580  9486   0x7f8000a130 ERROR                    omx gstomx.c:875:EventHandler:<omxh265enc-omxh265enc0> encoder got error: Undefined (0x80001001)
0:00:05.468496420  9486   0x5570620280 ERROR                    omx gstomx.c:363:gst_omx_component_handle_messages:<omxh265enc-omxh265enc0> encoder got error: Undefined (0x80001001)
0:00:05.468541090  9486   0x5570620280 ERROR                    omx gstomx.c:1409:gst_omx_component_get_state:<omxh265enc-omxh265enc0> encoder got error while waiting for state change: Undefined (0x80001001)
0:00:05.468583110  9486   0x5570620280 WARN             omxvideoenc gstomxvideoenc.c:3424:gst_omx_video_enc_handle_frame:<omxh265enc-omxh265enc0> error: Failed to enable OMX encoder: Undefined (0x80001001)
0:00:05.468784180  9486   0x5570620280 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<v4l2src0> error: Internal data stream error.
0:00:05.468817300  9486   0x5570620280 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<v4l2src0> error: streaming stopped, reason error (-5)
ERROR: from element /GstPipeline:pipeline0/GstOMXH265Enc-omxh265enc:omxh265enc-omxh265enc0: GStreamer encountered a general supporting library error.
Additional debug info:
../../git/omx/gstomxvideoenc.c(3424): gst_omx_video_enc_handle_frame (): /GstPipeline:pipeline0/GstOMXH265Enc-omxh265enc:omxh265enc-omxh265enc0:
Failed to enable OMX encoder: Undefined (0x80001001)
Execution ended after 0:00:05.342041210
Setting pipeline to PAUSED ...
[E] [SetParameter]: OMX_IndexParamPortDefinition: OMX_ErrorIncorrectStateOperation
0:00:05.469036090  9486   0x5570620280 ERROR                    omx gstomx.c:1564:gst_omx_component_set_parameter:<omxh265enc-omxh265enc0> Set encoder parameter at index 0x02000001: Incorrect state operation (0x80001018)
0:00:05.469095130  9486   0x5570620280 ERROR                    omx gstomx.c:1743:gst_omx_port_update_port_definition:<omxh265enc-omxh265enc0> Updated encoder port 0 definition: Incorrect state operation (0x80001018)
0:00:05.469134920  9486   0x5570620280 WARN             omxvideoenc gstomxvideoenc.c:3424:gst_omx_video_enc_handle_frame:<omxh265enc-omxh265enc0> error: Failed to enable OMX encoder: Undefined (0x80001001)
Setting pipeline to READY ...
0:00:05.469252890  9486   0x5570620280 WARN               mpegtsmux mpegtsmux.c:996:mpegtsmux_create_streams:<mux> error: Could not create handler for stream
0:00:05.469630870  9486   0x557061ab60 ERROR                    omx gstomx.c:1387:gst_omx_component_get_state:<omxh265enc-omxh265enc0> Component encoder in error state: Undefined (0x80001001)
0:00:05.469673440  9486   0x557061ab60 ERROR                    omx gstomx.c:1387:gst_omx_component_get_state:<omxh265enc-omxh265enc0> Component encoder in error state: Undefined (0x80001001)
Setting pipeline to NULL ...
0:00:05.532097200  9486   0x557061ab60 ERROR                    omx gstomx.c:1387:gst_omx_component_get_state:<omxh265enc-omxh265enc0> Component encoder in error state: Undefined (0x80001001)
0:00:05.532153870  9486   0x557061ab60 ERROR                    omx gstomx.c:2491:gst_omx_port_deallocate_buffers_unlocked:<omxh265enc-omxh265enc0> Component encoder in error state: Undefined (0x80001001)
0:00:05.532262190  9486   0x557061ab60 ERROR                    omx gstomx.c:2543:gst_omx_port_deallocate_buffers_unlocked:<omxh265enc-omxh265enc0> Deallocated buffers of encoder port 0: Undefined (0x80001001)
Freeing pipeline ...


Regards

Anil

 

0 Kudos