Pull RTSP stream failed on i.MX 8MP

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

Pull RTSP stream failed on i.MX 8MP

2,303 Views
noway
Contributor I

 

hi,  community

# iMX 8MP

@ Harvey021

I missed an issue during pull rtsp stream.

The "RTSP_URL" has has been verified using VLC.

Video coding: H264

command: gst-launch-1.0 rtspsrc location=$RTSP_URL queue ! rtph264depay ! v4l2h264dec ! autovideosink

target image version: linux6.6.36 full

target machine: i.MX 8mp

noway_1-1762140306278.png

 

0 Kudos
Reply
7 Replies

2,249 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi,

Please try to use below command.

gst-launch-1.0 -v rtspsrc location=$RTSP_URL protocols=tcp latency=100 ! rtph264depay ! avdec_h264 ! autovideosink



Best Regards,
Zhiming

0 Kudos
Reply

2,215 Views
noway
Contributor I

He indicated that the avdec_h264 was not found. 

noway_0-1762331427583.png

And then I try the v4l2h264dec, Nor was it successful. Please refer to the attachment for the error log.

trying command:  gst-launch-1.0 -v rtspsrc location=$RTSP_URL protocols=tcp latency=100 ! rtph264depay ! v4l2h264dec ! autovideosink > pull.log 2>&1

 

0 Kudos
Reply

2,131 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi,

Please try below command to split audio and video configuration.

gst-launch-1.0 -v rtspsrc location=xxxxx name=src protocols=tcp latency=100 \
  src. ! queue ! application/x-rtp,media=video,encoding-name=H264,payload=96  ! rtph264depay ! h264parse ! v4l2h264dec! videoconvert ! autovideosink \
  src. ! queue ! application/x-rtp,media=audio,encoding-name=MPEG4-GENERIC,payload=97 ! rtpmp4gdepay ! aacparse ! avdec_aac ! audioconvert ! audioresample ! autoaudiosink



Best Regards,
Zhiming

0 Kudos
Reply

2,118 Views
noway
Contributor I

Thank you for your reply, the decoding is now working. However, I still have two issues:

  1. When I change the video resolution from 1080p to 2K, it cannot decode

         Please refer to the attached file "pull.log" for the log.

      2. When decoding with Python, I found it takes 0.4 seconds to get one frame of data - why is it so slow? Please refer to the attached file "rtsp.py" for the code.

noway_0-1762767557119.png

 

0 Kudos
Reply

2,088 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @noway 

If you want to decode video for 60FPS, the maximum resolution is 1080p, the gstreamer has limited maximum resolution. The performance will decrease as the resolution increases on VPU.

For the opencv, you can try below configuration.

gst = f"rtspsrc location={RTSP_URL} protocols=tcp latency=50 ! " \
     f"rtph265depay ! h265parse config-interval=-1 ! " \
     f"decodebin ! videoconvert ! video/x-raw,format=BGR ! " \
     f"queue max-size-buffers=1 leaky=downstream ! " \
     f"appsink drop=true max-buffers=1 sync=false"
cap = cv2.VideoCapture(gst, cv2.CAP_GSTREAMER)



Best Regards,
Zhiming

0 Kudos
Reply

2,082 Views
noway
Contributor I

The video's fps is 10. The following is the detailed information.

noway_0-1762829616720.png

 

0 Kudos
Reply

1,840 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi,

Is there more information?

Best Regards,
Zhiming

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2197180%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EPull%20RTSP%20stream%20failed%20on%20i.MX%208MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2197180%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CBR%20%2F%3E%3CP%3Ehi%2C%26nbsp%3B%20community%3C%2FP%3E%3CP%3E%23%20iMX%208MP%3C%2FP%3E%3CP%3E%40%20Harvey021%3C%2FP%3E%3CP%3EI%20missed%20an%20issue%20during%20pull%20rtsp%20stream.%3C%2FP%3E%3CP%3EThe%20%22RTSP_URL%22%20has%20has%20been%20verified%20using%20VLC.%3C%2FP%3E%3CP%3EVideo%20coding%3A%20H264%3C%2FP%3E%3CP%3Ecommand%3A%26nbsp%3Bgst-launch-1.0%20rtspsrc%20location%3D%24RTSP_URL%20queue%20!%20rtph264depay%20!%20v4l2h264dec%20!%20autovideosink%3C%2FP%3E%3CP%3Etarget%20image%20version%3A%20linux6.6.36%20full%3C%2FP%3E%3CP%3Etarget%20machine%3A%20i.MX%208mp%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22noway_1-1762140306278.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22noway_1-1762140306278.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363637i66CB2C18F18D5FAF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22noway_1-1762140306278.png%22%20alt%3D%22noway_1-1762140306278.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2206445%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Pull%20RTSP%20stream%20failed%20on%20i.MX%208MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2206445%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20there%20more%20information%3F%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20Regards%2C%3CBR%20%2F%3EZhiming%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2202283%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Pull%20RTSP%20stream%20failed%20on%20i.MX%208MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2202283%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThe%20video's%20fps%20is%2010.%20The%20following%20is%20the%20detailed%20information.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22noway_0-1762829616720.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22noway_0-1762829616720.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364805i2881FFE5D1AB587F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22noway_0-1762829616720.png%22%20alt%3D%22noway_0-1762829616720.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2202257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Pull%20RTSP%20stream%20failed%20on%20i.MX%208MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2202257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F254955%22%20target%3D%22_blank%22%3E%40noway%3C%2FA%3E%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20you%20want%20to%20decode%20video%20for%2060FPS%2C%20the%20maximum%20resolution%20is%201080p%2C%20the%20gstreamer%20has%20limited%26nbsp%3Bmaximum%26nbsp%3Bresolution.%26nbsp%3B%3CSPAN%3EThe%20performance%20will%20decrease%20as%20the%20resolution%20increases%20on%20VPU.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFor%20the%20opencv%2C%20you%20can%20try%20below%20configuration.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Egst%20%3D%20f%22rtspsrc%20location%3D%7BRTSP_URL%7D%20protocols%3Dtcp%20latency%3D50%20!%20%22%20%5C%0A%20%20%20%20%20f%22rtph265depay%20!%20h265parse%20config-interval%3D-1%20!%20%22%20%5C%0A%20%20%20%20%20f%22decodebin%20!%20videoconvert%20!%20video%2Fx-raw%2Cformat%3DBGR%20!%20%22%20%5C%0A%20%20%20%20%20f%22queue%20max-size-buffers%3D1%20leaky%3Ddownstream%20!%20%22%20%5C%0A%20%20%20%20%20f%22appsink%20drop%3Dtrue%20max-buffers%3D1%20sync%3Dfalse%22%0Acap%20%3D%20cv2.VideoCapture(gst%2C%20cv2.CAP_GSTREAMER)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20Regards%2C%3CBR%20%2F%3EZhiming%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2201760%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Pull%20RTSP%20stream%20failed%20on%20i.MX%208MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2201760%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EThank%20you%20for%20your%20reply%2C%20the%20decoding%20is%20now%20working.%20However%2C%20I%20still%20have%20two%20issues%3A%3C%2FSPAN%3E%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EWhen%20I%20change%20the%20video%20resolution%20from%201080p%20to%202K%2C%20it%20cannot%20decode%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BPlease%20refer%20to%20the%20attached%20file%20%22pull.log%22%20for%20the%20log.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%202.%20When%20decoding%20with%20Python%2C%20I%20found%20it%20takes%200.4%20seconds%20to%20get%20one%20frame%20of%20data%20-%20why%20is%20it%20so%20slow%3F%26nbsp%3BPlease%20refer%20to%20the%20attached%20file%20%22rtsp.py%22%20for%20the%20code.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22noway_0-1762767557119.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22noway_0-1762767557119.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364672iF8811265B06795CA%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22noway_0-1762767557119.png%22%20alt%3D%22noway_0-1762767557119.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2201535%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Pull%20RTSP%20stream%20failed%20on%20i.MX%208MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2201535%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EPlease%20try%20below%20command%20to%20split%20audio%20and%20video%20configuration.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Egst-launch-1.0%20-v%20rtspsrc%20location%3Dxxxxx%20name%3Dsrc%20protocols%3Dtcp%20latency%3D100%20%5C%0A%20%20src.%20!%20queue%20!%20application%2Fx-rtp%2Cmedia%3Dvideo%2Cencoding-name%3DH264%2Cpayload%3D96%20%20!%20rtph264depay%20!%20h264parse%20!%20%3CSPAN%3Ev4l2h264dec%3C%2FSPAN%3E!%20videoconvert%20!%20autovideosink%20%5C%0A%20%20src.%20!%20queue%20!%20application%2Fx-rtp%2Cmedia%3Daudio%2Cencoding-name%3DMPEG4-GENERIC%2Cpayload%3D97%20!%20rtpmp4gdepay%20!%20aacparse%20!%20avdec_aac%20!%20audioconvert%20!%20audioresample%20!%20autoaudiosink%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20Regards%2C%3CBR%20%2F%3EZhiming%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2198879%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Pull%20RTSP%20stream%20failed%20on%20i.MX%208MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2198879%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHe%20indicated%20that%20the%20avdec_h264%20was%20not%20found.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22noway_0-1762331427583.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22noway_0-1762331427583.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364080i6FA7DBCD26542211%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22noway_0-1762331427583.png%22%20alt%3D%22noway_0-1762331427583.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EAnd%20then%20I%20try%20the%26nbsp%3Bv4l2h264dec%2C%20Nor%20was%20it%20successful.%26nbsp%3BPlease%20refer%20to%20the%20attachment%20for%20the%20error%20log.%3C%2FP%3E%3CP%3Etrying%20command%3A%26nbsp%3B%20gst-launch-1.0%20-v%20rtspsrc%20location%3D%24RTSP_URL%20protocols%3Dtcp%20latency%3D100%20!%20rtph264depay%20!%20v4l2h264dec%20!%20autovideosink%20%26gt%3B%20pull.log%202%26gt%3B%26amp%3B1%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2197849%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Pull%20RTSP%20stream%20failed%20on%20i.MX%208MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2197849%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3CBR%20%2F%3E%3CBR%20%2F%3EPlease%20try%20to%20use%20below%20command.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Egst-launch-1.0%20-v%20rtspsrc%20location%3D%24RTSP_URL%20protocols%3Dtcp%20latency%3D100%20!%20rtph264depay%20!%20avdec_h264%20!%20autovideosink%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20Regards%2C%3CBR%20%2F%3EZhiming%3C%2FP%3E%3C%2FLINGO-BODY%3E