HDMI In GStreamer stream breaks

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu

Which version of system do you use? Please provide the version of the system here:

5.15.137 Ubuntu 24.04

Please describe your issue below:

Hi, I ran this command:

gst-launch-1.0 v4l2src device=/dev/video71 io-mode=dmabuf ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=interleaved ! amlvenc ! 'video/x-h264, level=(string)4.1,profile=baseline' ! mpegtsmux ! queue ! srtserversink uri=srt://x.x.x.x:8890?streamid=publish:test

It started streaming for roughly 1-3 seconds, then it gets cut off. May I know what is the problem and how I can resolve it?

Post a console log of your issue below:

Setting pipeline to PAUSED ...
[API:aml_v4l2src_connect:271]Enter, devname : /dev/video71
driver : vdinvideo
device : mesont7
bus_info : vdin1 v4l2
version : 539099424
strcmp cap.driver: vdinvideo
func_name: aml_src_get_hdmi_method
initialize func addr: 0x7fbac70cbc
finalize func addr: 0x7fbac70ff0
start func addr: 0x7fbac71198
stop func addr: 0x7fbac712d8
change_divide_framerate, L69, dev /dev/video71, change_frame 1
change_divide_framerate L91 Set framerate div 2 success
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmisrc.c:102:hdmi_src_initialize]enter
khadas      9300  0.0  0.0   2380   800 pts/1    S+   16:21   0:00 sh -c -- ps -aux | grep hdmictrl
khadas      9302  0.0  0.0   6140  2016 pts/1    S+   16:21   0:00 grep hdmictrl
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmisrc.c:68:hdmi_src_obtain_devname]enter
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmisrc.c:79:hdmi_src_obtain_devname]hdmi_src_obtain_devname, pid=9303
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmisrc.c:87:hdmi_src_obtain_devname]hdmi_src_obtain_devname end, pid=9303
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmisrc.c:79:hdmi_src_obtain_devname]hdmi_src_obtain_devname, pid=0
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmisrc.c:83:hdmi_src_obtain_devname]ready to execl /usr/bin/hdmictrl, pid=0
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:304:main]enter, prepare enter hdmi_rx_svctx_init
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:256:hdmi_rx_svctx_init]enter
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:264:hdmi_rx_svctx_init]prepare get the GetInstance
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:271:hdmi_rx_svctx_init]go hdmi_rx_svctx_perform_connect
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:202:hdmi_rx_svctx_perform_connect]enter
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:229:hdmi_rx_svctx_perform_connect][452434642]UNIX domain socket (/tmp/hdmi-rx0) bound
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:238:hdmi_rx_svctx_perform_connect][452481308]Accepting connections,get the client_unix_len: 110
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src common/common.c:70:udp_sock_create][452522516][/tmp/hdmi-rx0] start connect
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmisrc.c:97:hdmi_src_obtain_devname]exit
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmisrc.c:109:hdmi_src_initialize]send_buffer:fd:11 buf:connect
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmisrc.c:112:hdmi_src_initialize]exit
[API:aml_v4l2src_connect:324]Exit, HDMI RX
devname : /dev/video71
driver : vdinvideo
device : mesont7
bus_info : vdin1 v4l2
version : 539099424
hdmirx tvin-port use 0
[API:aml_v4l2src_streamon:373]Enter
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmisrc.c:138:hdmi_src_start]enter
unix  2      [ ACC ]     STREAM     LISTENING     50272    /tmp/hdmi-rx0
unix  3      [ ]         STREAM     CONNECTED     50273    /tmp/hdmi-rx0
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:248:hdmi_rx_svctx_perform_connect]g_t_svctx prepare get the connect_socker_fd 7
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:251:hdmi_rx_svctx_perform_connect]exit
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:278:hdmi_rx_svctx_init]exit
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:311:main]prepare enter setTvEventCallback
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:314:main]prepare enter process_socket_thread
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:139:process_socket_thread]enter
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:144:process_socket_thread]hdmirxsrc is hdmi2
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:156:process_socket_thread]HDMISRC is hdmi2
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:165:process_socket_thread]e_currentsource = 6
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:169:process_socket_thread]loop wait recv cmd
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:171:process_socket_thread]recv_buffer = connect
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:172:process_socket_thread]r = 32 errno = 0
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:183:process_socket_thread]Enter connect_hdmi
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:186:process_socket_thread]Exit connect_hdmi
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:189:process_socket_thread]startv is ok
[2025-02-04 16:21:33]  DEBUG  [amlv4l2src hdmictrl.c:169:process_socket_thread]loop wait recv cmd
[2025-02-04 16:21:35]  DEBUG  [amlv4l2src hdmictrl.c:117:TvEventCallback]source: 6, signalFmt: 1034, transFmt: 0, status: 4, isDVI: 0, Hdrinfo: 65792d
[2025-02-04 16:21:35]  DEBUG  [amlv4l2src hdmictrl.c:125:TvEventCallback]SignalStatus is stable
[2025-02-04 16:21:35]  DEBUG  [amlv4l2src hdmictrl.c:80:_send_signal_stable]send_buffer: sigstable, errno 22 [104]
[2025-02-04 16:21:35]  DEBUG  [amlv4l2src hdmisrc.c:142:hdmi_src_start]recv_buffer: sigstable, r 9, errno 2
[2025-02-04 16:21:35]  DEBUG  [amlv4l2src hdmisrc.c:144:hdmi_src_start]exit
[API:aml_v4l2src_streamon:376]Exit
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Set log level to 1
[selectHW:105] selectEncoder
[selectHW:109] amvenc_multi 264 present
[amvenc_multi_load_Module:40] amvenc_ports multi loadModule!, load_count:0

Set log level to 4
[initEncParams:266] enc_feature_opts is 0x1 , GopPresetis 0x0

[vdi_sys_sync_inst_param:673] [VDI] fail to deliver sync instance param inst_idx=0

[AML_MultiEncInitialize:1388] VPU instance param sync with open param failed

[SetSequenceInfo:989] Required buffer fb_num=3, src_num=1, actual src=3 1920x1080

Redistribute latency...
[vl_multi_encoder_adjust_h264_header:626] sps_start=0

[vl_multi_encoder_adjust_h264_sps:558] crop top:0,left:0,right:0,bottom:4,enable:1
Redistribute latency...
0:00:00.1 / 99:99:99.

Hello @WongTX

Could you make it work follow this documentation?

https://docs.khadas.com/products/sbc/vim4/applications/hdmi-input-5.15

Hi @numbqq thank you for the reply, I already tried this

gst-launch-1.0 v4l2src device=/dev/video71 io-mode=dmabuf num-buffers=300 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=interleaved ! amlvenc ! h264parse ! qtmux ! filesink location=/tmp/test71.mp4

Either this command or the command I used at the top, it still freeze after 1-3 seconds

Is the log useful for identifying the problem? I dont really know what’s the issue even with the log

The sudo hdmiin demo is working, just the gstreamer one is not.

Hello @WongTX

What’s your HDMI IN source? Have you checked other HDMI IN source?

Hi @numbqq Currently, nope. I will try out another HDMI device and let you know how it goes. But currently, does the error log provide any useful information as to why it crashed?

Hi @numbqq I have tested another HDMI device, still the same problem, cuts off after 3 seconds

Hi numbqq, apologies for the mistake. Apparently I had another program streaming using the same encoder, so it failed. After remove the program, it worked normally. Thank you very much so your time, have a nice day!

1 Like