Firefly开源社区

12
发表新贴
打印 上一主题 下一主题

[应用开发] rtsp推流问题

48

积分

0

威望

0

贡献

技术小白

积分
48

rtsp推流问题

发表于 2021-12-7 09:19:27      浏览:16231 | 回复:17        打印      只看该作者   [复制链接] 楼主
你好
  使用core-1126-JD4+配套底板开发时,遇到流媒体推流问题,麻烦看下,谢谢
现象:

  在使用core-1126-JD4推流时,用VLC能够打开流媒体,但是流媒体卡在第一张画面上,后面视频看不到
硬件接线:
1、使用一路网口接海康网络摄影头
2、使用另一路网口推流
软件流程:
1、获取rtsp流(使用ffrtsp库)->decode->encode->rtsp推流
测试log:
  1. [root@RV1126_RV1109:/userdata/data/wdg]# ./rtsp_vdec_rga_venc
  2. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libffrtsp.so)
  3. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libffrtsp.so)
  4. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libffrtsp.so)
  5. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face_engine.so)
  6. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face_engine.so)
  7. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face_engine.so)
  8. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face_engine.so)
  9. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face.so)
  10. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face.so)
  11. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face.so)
  12. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face.so)
  13. ./rtsp_vdec_rga_venc: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face.so)
  14. media get entity by name: rkcif-lvds-subdev is null
  15. media get entity by name: rkcif-lite-lvds-subdev is null
  16. media get entity by name: rkisp-mpfbc-subdev is null
  17. media get entity by name: rkisp_dmapath is null
  18. media get entity by name: rockchip-mipi-dphy-rx is null
  19. Rga built version:1.04 cb973b1+2021-06-01 11:34:20
  20. [INFO  rtsp_demo.c:281:rtsp_new_demo] rtsp server demo starting on port 8554
  21. [DEBUG rtsp_demo.c:481:rtsp_new_session] add session path: /live/main_stream
  22. ##RKMEDIA Log level: 2
  23. [RKMEDIA][SYS][Info]:text is all=2
  24. [RKMEDIA][SYS][Info]:module is all, log_level is 2
  25. [RKMEDIA][SYS][Info]:RK_MPI_VDEC_CreateChn: Enable VDEC[0] Start...
  26. mpp[2248]: mpp_info: mpp version: 92a7c2a4 author: daijh         2021-04-21 debian: fix patch not found bug
  27. [RKMEDIA][VDEC][Info]:mpi control MPP_DEC_SET_PARSER_SPLIT_MODE ret = 0
  28. mpp[2248]: mpp_rt: NOT found ion allocator
  29. mpp[2248]: mpp_rt: found drm allocator
  30. [RKMEDIA][VDEC][Info]:mpi set group limit = 16
  31. [RKMEDIA][SYS][Info]:RK_MPI_VDEC_CreateChn: Enable VDEC[0] End!
  32. [RKMEDIA][SYS][Info]:RK_MPI_VENC_CreateChn: Enable VENC[0], Type:6 Start...
  33. mpp[2248]: mpp_info: mpp version: 92a7c2a4 author: daijh         2021-04-21 debian: fix patch not found bug
  34. [RKMEDIA][VENC][Info]:MPP Encoder: MPPConfig: cfg init sucess!
  35. [RKMEDIA][VENC][Info]:MPP Encoder: qpMaxi use default value:48
  36. [RKMEDIA][VENC][Info]:MPP Encoder: qpMini use default value:8
  37. [RKMEDIA][VENC][Info]:MPP Encoder: qpMax use default value:48
  38. [RKMEDIA][VENC][Info]:MPP Encoder: qpMin use default value:8
  39. [RKMEDIA][VENC][Info]:MPP Encoder: qpInit use default value:-1
  40. [RKMEDIA][VENC][Info]:MPP Encoder: qpStep use default value:2
  41. [RKMEDIA][VENC][Info]:MPP Encoder: rotaion = 0
  42. [RKMEDIA][VENC][Info]:MPP Encoder: automatically calculate bsp with bps_max
  43. [RKMEDIA][VENC][Info]:MPP Encoder: Set output block mode.
  44. [RKMEDIA][VENC][Info]:MPP Encoder: Set input block mode.
  45. [RKMEDIA][VENC][Info]:MPP Encoder: bps:[4147200,3732480,1036800] fps: [25/1]->[25/1], gop:25 qpInit:-1, qpMin:8, qpMax:48, qpMinI:8, qpMaxI:48.
  46. [RKMEDIA][VENC][Info]:MPP Encoder: H264 profile use defalut value: 100[RKMEDIA][VENC][Info]:MPP Encoder: AVC: encode profile 100 level 0
  47. mpp[2248]: mpp_enc: MPP_ENC_SET_RC_CFG bps 3732480 [1036800 : 4147200] fps [25:25] gop 25
  48. mpp[2248]: h264e_api_v2: MPP_ENC_SET_PREP_CFG w:h [1920:1080] stride [1920:1088]
  49. mpp[2248]: mpp_enc: send header for set cfg change input/format
  50. [RKMEDIA][VENC][Info]:MPP Encoder: w x h(1920[1920] x 1080[1088])
  51. mpp[2248]: mpp_enc: mode cbr bps [1036800:3732480:4147200] fps fix [25/1] -> fix [25/1] gop i [25] v [0]
  52. [RKMEDIA][SYS][Info]:RK_MPI_VENC_CreateChn: Enable VENC[0], Type:6 End...
  53. [RKMEDIA][SYS][Info]:RK_MPI_RGA_CreateChn: Enable RGA[0], Rect<0,0,1920,1080> Start...
  54. [RKMEDIA][SYS][Info]:FilterFlow:rkrga: Enable BufferPool! memtype:hw_mem, memcnt:12
  55. [RKMEDIA][SYS][Info]:Opened DRM device /dev/dri/card0: driver rockchip version 2.0.0.
  56. [RKMEDIA][SYS][Info]:RK_MPI_RGA_CreateChn: Enable RGA[0], Rect<0,0,1920,1080> End...
  57. [RKMEDIA][SYS][Info]:RK_MPI_SYS_Bind: Bind Mode[VDEC]:Chn[0] to Mode[RGA]:Chn[0]...
  58. [RKMEDIA][SYS][Info]:RK_MPI_SYS_Bind: Bind Mode[VDEC]:Chn[0] to Mode[VENC]:Chn[0]...
  59. Created new TCP socket 41 for connection
  60. Connecting to 192.168.1.5, port 554 on socket 41...
  61. ...remote connection opened
  62. Sending request: DESCRIBE rtsp://admin:zd123456@192.168.1.5 RTSP/1.0
  63. CSeq: 2
  64. User-Agent: ffrtspGet (LIVE555 Streaming Media v2017.10.28)
  65. Accept: application/sdp


  66. Received 184 new bytes of response data.
  67. Received a complete DESCRIBE response:
  68. RTSP/1.0 401 Unauthorized
  69. CSeq: 2
  70. WWW-Authenticate: Digest realm="IP Camera(F3061)", nonce="cdad57661c65aa2e1ea2d78f3351752a", stale="FALSE"
  71. Date:  Mon, Dec 06 2021 22:04:14 GMT


  72. Resending...
  73. Sending request: DESCRIBE rtsp://admin:zd123456@192.168.1.5 RTSP/1.0
  74. CSeq: 3
  75. Authorization: Digest username="admin", realm="IP Camera(F3061)", nonce="cdad57661c65aa2e1ea2d78f3351752a", uri="rtsp://admin:zd123456@192.168.1.5", response="6d2d88caa84c04e93e30b7cbf7ee7c25"
  76. User-Agent: ffrtspGet (LIVE555 Streaming Media v2017.10.28)
  77. Accept: application/sdp


  78. Received 702 new bytes of response data.
  79. Received a complete DESCRIBE response:
  80. RTSP/1.0 200 OK
  81. CSeq: 3
  82. Content-Type: application/sdp
  83. Content-Base: rtsp://admin:zd123456@192.168.1.5/
  84. Content-Length: 572

  85. v=0
  86. o=- 1638828254932574 1638828254932574 IN IP4 192.168.1.5
  87. s=Media Presentation
  88. e=NONE
  89. b=AS:5050
  90. t=0 0
  91. a=control:rtsp://admin:zd123456@192.168.1.5/
  92. m=video 0 RTP/AVP 96
  93. c=IN IP4 0.0.0.0
  94. b=AS:5000
  95. a=recvonly
  96. a=x-dimensions:1920,1080
  97. a=control:rtsp://admin:zd123456@192.168.1.5/trackID=1
  98. a=rtpmap:96 H264/90000
  99. a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AKpY1QPAET8s3AQEBQAABwgAAV+QB,aO4xsg==
  100. a=Media_header:MEDIAINFO=494D4B48010300000400000100000000000000000000000000000000000000000000000000000000;
  101. a=appversion:1.0

  102. [URL:"rtsp://admin:zd123456@192.168.1.5/"]: Got a SDP description:
  103. v=0
  104. o=- 1638828254932574 1638828254932574 IN IP4 192.168.1.5
  105. s=Media Presentation
  106. e=NONE
  107. b=AS:5050
  108. t=0 0
  109. a=control:rtsp://admin:zd123456@192.168.1.5/
  110. m=video 0 RTP/AVP 96
  111. c=IN IP4 0.0.0.0
  112. b=AS:5000
  113. a=recvonly
  114. a=x-dimensions:1920,1080
  115. a=control:rtsp://admin:zd123456@192.168.1.5/trackID=1
  116. a=rtpmap:96 H264/90000
  117. a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AKpY1QPAET8s3AQEBQAABwgAAV+QB,aO4xsg==
  118. a=Media_header:MEDIAINFO=494D4B48010300000400000100000000000000000000000000000000000000000000000000000000;
  119. a=appversion:1.0

  120. [URL:"rtsp://admin:zd123456@192.168.1.5/"]: Initiated the "video/H264" subsession (client ports 36746-36747)
  121. Sending request: SETUP rtsp://admin:zd123456@192.168.1.5/trackID=1 RTSP/1.0
  122. CSeq: 4
  123. Authorization: Digest username="admin", realm="IP Camera(F3061)", nonce="cdad57661c65aa2e1ea2d78f3351752a", uri="rtsp://admin:zd123456@192.168.1.5/", response="10c4a1dfcdf2b5c1651238c954e703d1"
  124. User-Agent: ffrtspGet (LIVE555 Streaming Media v2017.10.28)
  125. Transport: RTP/AVP;unicast;client_port=36746-36747


  126. Received 204 new bytes of response data.
  127. Received a complete SETUP response:
  128. RTSP/1.0 200 OK
  129. CSeq: 4
  130. Session:       1383322580;timeout=60
  131. Transport: RTP/AVP;unicast;client_port=36746-36747;server_port=8218-8219;ssrc=32cb7432;mode="play"
  132. Date:  Mon, Dec 06 2021 22:04:14 GMT


  133. [URL:"rtsp://admin:zd123456@192.168.1.5/"]: Set up the "video/H264" subsession (client ports 36746-36747)
  134. [URL:"rtsp://admin:zd123456@192.168.1.5/"]: Created a data sink for the "video/H264" subsession
  135. Sending request: PLAY rtsp://admin:zd123456@192.168.1.5/ RTSP/1.0
  136. CSeq: 5
  137. Authorization: Digest username="admin", realm="IP Camera(F3061)", nonce="cdad57661c65aa2e1ea2d78f3351752a", uri="rtsp://admin:zd123456@192.168.1.5/", response="35c213136d0091d0a2f465b9d6650e24"
  138. User-Agent: ffrtspGet (LIVE555 Streaming Media v2017.10.28)
  139. Session: 1383322580
  140. Range: npt=0.000-


  141. Received 179 new bytes of response data.
  142. Received a complete PLAY response:
  143. RTSP/1.0 200 OK
  144. CSeq: 5
  145. Session:       1383322580
  146. RTP-Info: url=rtsp://admin:zd123456@192.168.1.5/trackID=1;seq=1629;rtptime=190893420
  147. Date:  Mon, Dec 06 2021 22:04:15 GMT


  148. [URL:"rtsp://admin:zd123456@192.168.1.5/"]: Started playing session...
  149. [RKMEDIA][VDEC][Info]:MppDec Info change get, 1920x1080 in (1920x1088)
  150. [RKMEDIA][RGA][Error]:Src(0Bytes) or Dst(6220800Bytes) Buffer is invalid!
  151. mpp[2248]: mpp_buffer: mpp_buffer_put invalid input: buffer NULL from PrepareMppFrame
  152. mpp[2248]: h264e_sps: set level to 4
  153. [DEBUG utils.c:160:rtsp_codec_data_parse_from_user_h264] sps 27
  154. [DEBUG utils.c:168:rtsp_codec_data_parse_from_user_h264] pps 4
复制代码
测试代码:
  1. #include <assert.h>
  2. #include <fcntl.h>
  3. #include <pthread.h>
  4. #include <signal.h>
  5. #include <stdbool.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <time.h>
  10. #include <unistd.h>
  11. #include <sys/time.h>
  12. #include "common/sample_common.h"
  13. #include "rkmedia_api.h"
  14. #include "rkmedia_vdec.h"
  15. #include "ffrtsp/ffrtsp.hh"
  16. #include "librtsp/rtsp_demo.h"
  17. #define  full_flow1
  18. #define  close_mux1
  19. //视频流处理pipeline
  20. //rtsp->vdec->rga->im2gray->算法处理(测试RGA直接转IMAGE_TYPE_GRAY8)->处理结果添加水印->venc->rtsp推流
  21. //                        ->venc->保存历史视频(mux测试)
  22. //                        ->venc->添加水印—>rtsp流(后期流程)

  23. typedef struct rkMuxerHandle {
  24.         RK_U32 u32ModeIdx;
  25.         RK_U32 u32ChnIdx;
  26. } MuxerHandle;

  27. rtsp_demo_handle g_rtsplive = NULL;
  28. static rtsp_session_handle g_rtsp_session;
  29. static bool quit = false;
  30. static void sigterm_handler(int sig) {
  31.         fprintf(stderr, "signal %d\n", sig);
  32.         quit = true;
  33. }

  34. static long getCurrentTimeMsec() {
  35.         long msec = 0;
  36.         char str[20] = {0};
  37.         struct timeval stuCurrentTime;

  38.         gettimeofday(&stuCurrentTime, NULL);
  39.         sprintf(str, "%ld%03ld", stuCurrentTime.tv_sec,(stuCurrentTime.tv_usec) / 1000);
  40.         for (size_t i = 0; i < strlen(str); i++) {
  41.                 msec = msec * 10 + (str[i] - '0');
  42.         }

  43.         return msec;
  44. }

  45. static RK_U32 gu32FileIdx;
  46. int GetRecordFileName(RK_VOID *pHandle, RK_U32 u32FileCnt,RK_CHAR **pcFileName) {
  47.        
  48.         printf("#%s: Handle:%p, idx:%u ...\n", __func__, pHandle, *((RK_U32 *)pHandle));
  49.          
  50.         for (RK_U32 i = 0; i < u32FileCnt; i++) {
  51.                 sprintf(pcFileName[i], "/userdata/MuxerCbTest_%u.mp4",*((RK_U32 *)pHandle));
  52.           }

  53.          printf("#%s: NewRecordFileName:[%s]\n", __func__, pcFileName[0]);

  54.           *((RK_U32 *)pHandle) = *((RK_U32 *)pHandle) + 1;

  55.           return 0;
  56. }
  57. void muxer_event_cb(RK_VOID *pHandle, RK_VOID *pstEvent) {
  58.         RK_S32 s32ModeIdx = -1;
  59.         RK_S32 s32ChnIdx = -1;

  60.         printf("### %s: Handle:%p, event:%p\n", __func__, pHandle, pstEvent);
  61.         if (pHandle) {
  62.                 MuxerHandle *pstMuxerHandle = (MuxerHandle *)pHandle;
  63.                 s32ModeIdx = (RK_S32)pstMuxerHandle->u32ModeIdx;
  64.                 s32ChnIdx = (RK_S32)pstMuxerHandle->u32ChnIdx;
  65.         }
  66.         if (pstEvent) {
  67.                 MUXER_EVENT_INFO_S *pstMuxerEvent = (MUXER_EVENT_INFO_S *)pstEvent;
  68.                 printf("@@@ %s: ModeID:%d, ChnID:%d, EventType:%d, filename:%s, value:%d\n",
  69.                 __func__, s32ModeIdx, s32ChnIdx, pstMuxerEvent->enEvent,
  70.                 pstMuxerEvent->unEventInfo.stFileInfo.asFileName,
  71.                 (int)pstMuxerEvent->unEventInfo.stFileInfo.u32Duration);
  72.         }
  73. }

  74. int FFRKMedia_Vdec_Send(u_int8_t* framebuff,unsigned framesize,bool * pquit,int cur_chn)
  75. {
  76.         //RTSP流数据送到decode通道
  77.     MEDIA_BUFFER mb = RK_MPI_MB_CreateBuffer(framesize, RK_FALSE, 0);
  78.     RK_MPI_MB_SetSize(mb, framesize);
  79.     memcpy(RK_MPI_MB_GetPtr(mb) ,framebuff , framesize);
  80.     RK_MPI_MB_SetSize(mb, framesize);
  81.     RK_MPI_SYS_SendMediaBuffer(RK_ID_VDEC, 0, mb);

  82.        
  83.        
  84.     RK_MPI_MB_ReleaseBuffer(mb);
  85.     if (quit)
  86.             *pquit = true;
  87. }

  88. void vdec_packet_cb(MEDIA_BUFFER mb) {
  89.          // decode 流媒体数据为NV12
  90.         int ret;
  91.         static RK_U32 jpeg_id = 0;
  92.         MB_IMAGE_INFO_S stImageInfo = {0};
  93.         ret = RK_MPI_MB_GetImageInfo(mb, &stImageInfo);//指定图像中获取图像信息 ,宽高,图片格式
  94.         if (ret) {
  95.                 printf("Get image info failed! ret = %d\n", ret);
  96.                 RK_MPI_MB_ReleaseBuffer(mb);
  97.                 return ;
  98.         }
  99.         printf("Get Frame:ptr:%p, fd:%d, size:%zu, mode:%d, channel:%d, "
  100.              "timestamp:%lld, ImgInfo:<wxh %dx%d, fmt 0x%x>\n",
  101.              RK_MPI_MB_GetPtr(mb), RK_MPI_MB_GetFD(mb), RK_MPI_MB_GetSize(mb),
  102.              RK_MPI_MB_GetModeID(mb), RK_MPI_MB_GetChannelID(mb),
  103.              RK_MPI_MB_GetTimestamp(mb), stImageInfo.u32Width,
  104.              stImageInfo.u32Height, stImageInfo.enImgType);
  105. /*        char jpeg_path[128];
  106.         sprintf(jpeg_path, "/userdata/data/test_yuv%d.yuv", jpeg_id);
  107.         FILE *file = fopen(jpeg_path, "w");
  108.         if (file) {
  109.                 fwrite(RK_MPI_MB_GetPtr(mb), 1, RK_MPI_MB_GetSize(mb), file);
  110.                 fclose(file);
  111.         }*/
  112.         RK_MPI_MB_ReleaseBuffer(mb);
  113.         jpeg_id++;
  114. }

  115. static void *MainStream(void * data)  {
  116.         MEDIA_BUFFER buffer;
  117.         char jpeg_path[128];
  118.         static RK_U32 jpeg_id = 0;

  119.         while (!quit) {
  120.                 //printf("%s\n",__func__);
  121.                 buffer = RK_MPI_SYS_GetMediaBuffer(RK_ID_RGA, 0, -1);
  122.                 if (!buffer)
  123.                         continue;
  124. /*                sprintf(jpeg_path, "/userdata/data/test%d.jpg", jpeg_id);
  125.                 FILE *file = fopen(jpeg_path, "w");
  126.                 if (file) {
  127.                         fwrite(RK_MPI_MB_GetPtr(buffer), 1, RK_MPI_MB_GetSize(buffer), file);
  128.                         fclose(file);
  129.                 }*/
  130.                 RK_MPI_MB_ReleaseBuffer(buffer);
  131.                 jpeg_id++;
  132.         }
  133. }

  134. static FILE *g_output_file=NULL;
  135. #define video_output_path "/userdata/data/"
  136. #define video_output_length                        25*60*3                //fps=25,3分钟一个视频
  137. static void venc_packet_cb(MEDIA_BUFFER mb) {
  138.         static RK_S32 packet_cnt = 0;
  139.         if (quit)
  140.                 return;

  141.         printf("#Get packet-%d, size %zu\n", packet_cnt, RK_MPI_MB_GetSize(mb));

  142.         if (g_rtsplive && g_rtsp_session) {
  143.                 printf("rtsp push \n");
  144.                 rtsp_tx_video(g_rtsp_session, (uint8_t*)RK_MPI_MB_GetPtr(mb), RK_MPI_MB_GetSize(mb),
  145.                 RK_MPI_MB_GetTimestamp(mb)); // RTSP 发送,通过获取 MB 编码数据虚拟地址,大小,时间戳,然后发送
  146.                 rtsp_do_event(g_rtsplive);
  147.         }

  148.         RK_MPI_MB_ReleaseBuffer(mb);
  149.         packet_cnt++;
  150.         /*       
  151.         static RK_S32 packet_cnt = 0;
  152.         char pOutPath[128];
  153.         struct tm t;
  154.         struct timespec time = { 0, 0 };
  155.         printf("%s\n",__func__);
  156. #if 1
  157.         if(packet_cnt==0)
  158.         {
  159.                 clock_gettime(CLOCK_REALTIME, &time);
  160.                 strftime(pOutPath, sizeof(pOutPath), "/userdata/data/%Y-%m-%d-%H-%M-%S.h264", localtime_r(&time.tv_sec, &t));
  161.                 printf("video file name=%s\n",pOutPath);
  162.                 if (!g_output_file) {
  163.                         g_output_file = fopen(pOutPath, "w");
  164.                         if (!g_output_file) {
  165.                                 printf("ERROR: open file: %s fail, exit\n", pOutPath);
  166.                                 return ;
  167.                         }
  168.                 }
  169.         }
  170. #endif
  171. #if 1
  172.         if (quit)
  173.                 return;

  174.         const char *nalu_type = "Jpeg data";
  175.         switch (RK_MPI_MB_GetFlag(mb)) {
  176.                 case VENC_NALU_IDRSLICE:
  177.                         nalu_type = "IDR Slice";
  178.                         break;
  179.                 case VENC_NALU_PSLICE:
  180.                         nalu_type = "P Slice";
  181.                         break;
  182.                 default:
  183.                         break;
  184.         }

  185.         if (g_output_file) {
  186.                 fwrite(RK_MPI_MB_GetPtr(mb), 1, RK_MPI_MB_GetSize(mb), g_output_file);
  187.                 printf("#Write packet-%d, %s, size %zu\n", packet_cnt, nalu_type,
  188.                 RK_MPI_MB_GetSize(mb));
  189.         } else {
  190.                 printf("#Get packet-%d, %s, size %zu\n", packet_cnt, nalu_type,
  191.                 RK_MPI_MB_GetSize(mb));
  192.         }
  193.         RK_MPI_MB_TsNodeDump(mb);
  194.         RK_MPI_MB_ReleaseBuffer(mb);
  195. #endif
  196.         packet_cnt++;
  197. #if 1
  198.         if(packet_cnt==video_output_length)
  199.         {
  200.                 if (g_output_file)
  201.                         fclose(g_output_file);
  202.                 g_output_file = NULL;
  203.                 packet_cnt = 0;
  204.         }
  205. #endif
  206. */
  207. }

  208. static void rga_packet_cb(MEDIA_BUFFER mb) {
  209.         static RK_U32 jpeg_id = 0;

  210.         if (quit)
  211.                 return;
  212.         printf("%s\n",__func__);

  213. /*        char jpeg_path[128];
  214.         sprintf(jpeg_path, "/userdata/data/test%d.jpg", jpeg_id);
  215.         FILE *file = fopen(jpeg_path, "w");
  216.         if (file) {
  217.         fwrite(RK_MPI_MB_GetPtr(mb), 1, RK_MPI_MB_GetSize(mb), file);
  218.         fclose(file);
  219.         } */

  220.         RK_MPI_MB_TsNodeDump(mb);
  221.         RK_MPI_MB_ReleaseBuffer(mb);
  222.         jpeg_id++;

  223. }

  224. int main(int argc, char *argv[])
  225. {
  226.         int ret=0;
  227.          
  228.         signal(SIGINT, sigterm_handler);
  229. #if 0       
  230.         RK_CHAR *pOutPath = (char*)"/userdata/data/save.h264";
  231.         if (pOutPath) {
  232.                 g_output_file = fopen(pOutPath, "w");
  233.                 if (!g_output_file) {
  234.                         printf("ERROR: open file: %s fail, exit\n", pOutPath);
  235.                         return 0;
  236.                 }
  237.         }
  238. #endif
  239.                //设置rtsp推流属性
  240.         g_rtsplive = create_rtsp_demo(554);
  241.         if(g_rtsplive==NULL)
  242.                 printf("g_rtsplive is null\n");
  243.         g_rtsp_session = rtsp_new_session(g_rtsplive, "/live/main_stream");
  244.         if(g_rtsp_session == NULL)
  245.                 printf("g_rtsp_session is null\n");
  246.         rtsp_set_video(g_rtsp_session, RTSP_CODEC_ID_VIDEO_H264, NULL, 0);
  247. //      rtsp_sync_video_ts(g_rtsp_session, rtsp_get_reltime(), rtsp_get_ntptime()); //rtsp 同步当前网络时间
  248.         RK_MPI_SYS_Init();//初始化 MPI 系统

  249.         //设置decode属性
  250.         VDEC_CHN_ATTR_S stVdecAttr;
  251.         stVdecAttr.enCodecType = RK_CODEC_TYPE_H264;
  252.         stVdecAttr.enMode = VIDEO_MODE_STREAM;
  253.         stVdecAttr.enDecodecMode = VIDEO_DECODEC_HADRWARE;

  254.         ret = RK_MPI_VDEC_CreateChn(0, &stVdecAttr);
  255.         if (ret) {
  256.                 printf("Create Vdec[0] failed! ret=%d\n", ret);
  257.                 return -1;
  258.         }

  259.         //设置decode有数据时 回调
  260.         MPP_CHN_S VdecChn; //定义模块设备通道结构体。
  261.         VdecChn.enModId = RK_ID_VDEC;
  262.         VdecChn.s32DevId = 0;
  263.         VdecChn.s32ChnId = 0;
  264.         /*ret = RK_MPI_SYS_RegisterOutCb(&VdecChn, vdec_packet_cb); //注册数据输出回调。
  265.         if (ret) {
  266.                 printf("ERROR: register output callback for Vdec[0] error! ret=%d\n", ret);
  267.                 return 0;
  268.         }*/

  269.         //设置encode属性
  270.         MPP_CHN_S VencChn;
  271.         VencChn.enModId = RK_ID_VENC;
  272.         VencChn.s32DevId = 0;
  273.         VencChn.s32ChnId = 0;
  274.        
  275.         VENC_CHN_ATTR_S venc_chn_attr;
  276.         memset(&venc_chn_attr, 0, sizeof(venc_chn_attr));

  277.         venc_chn_attr.stVencAttr.enType = RK_CODEC_TYPE_H264;
  278.         venc_chn_attr.stRcAttr.enRcMode = VENC_RC_MODE_H264VBR;
  279.         venc_chn_attr.stRcAttr.stH264Vbr.u32Gop = 25;

  280.         venc_chn_attr.stRcAttr.stH264Vbr.u32MaxBitRate = 1920 * 1080 * 2;
  281.         // frame rate: in 30/1, out 30  /1.
  282.         venc_chn_attr.stRcAttr.stH264Vbr.fr32DstFrameRateDen = 1;
  283.         venc_chn_attr.stRcAttr.stH264Vbr.fr32DstFrameRateNum = 25;
  284.         venc_chn_attr.stRcAttr.stH264Vbr.u32SrcFrameRateDen = 1;
  285.         venc_chn_attr.stRcAttr.stH264Vbr.u32SrcFrameRateNum = 25;

  286.         venc_chn_attr.stVencAttr.imageType = IMAGE_TYPE_NV12; //输入图片的格式,和 VI 输出保持一致
  287.         venc_chn_attr.stVencAttr.u32PicWidth = 1920; //编码图像宽度,单位像素点
  288.         venc_chn_attr.stVencAttr.u32PicHeight = 1080;//编码图像高度,单位像素点
  289.         venc_chn_attr.stVencAttr.u32VirWidth = 1920;//stride 宽度,必须 16 对齐
  290.         venc_chn_attr.stVencAttr.u32VirHeight = 1080 + 8;// stride 高度,必须 16 对齐
  291.         venc_chn_attr.stVencAttr.u32Profile = 77; //编码等级 77,是中级 66,基础等级,100,高级
  292.         ret = RK_MPI_VENC_CreateChn(0, &venc_chn_attr);//创建通道
  293.        
  294.         ret = RK_MPI_SYS_RegisterOutCb(&VencChn, venc_packet_cb); //注册数据输出回调。
  295.         if (ret) {
  296.                 printf("ERROR: register output callback for Vdec[0] error! ret=%d\n", ret);
  297.                 return 0;
  298.         }       
  299. #ifdef full_flow
  300.         MPP_CHN_S VencChn1;
  301.         VencChn1.enModId = RK_ID_VENC;
  302.         VencChn1.s32DevId = 0;
  303.         VencChn1.s32ChnId = 1;
  304.        
  305.         memset(&venc_chn_attr, 0, sizeof(venc_chn_attr));

  306.         venc_chn_attr.stVencAttr.enType = RK_CODEC_TYPE_H264;
  307.         venc_chn_attr.stRcAttr.enRcMode = VENC_RC_MODE_H264VBR;
  308.         venc_chn_attr.stRcAttr.stH264Vbr.u32Gop = 25;

  309.         venc_chn_attr.stRcAttr.stH264Vbr.u32MaxBitRate = 1920 * 1080 * 2;
  310.         // frame rate: in 30/1, out 30  /1.
  311.         venc_chn_attr.stRcAttr.stH264Vbr.fr32DstFrameRateDen = 1;
  312.         venc_chn_attr.stRcAttr.stH264Vbr.fr32DstFrameRateNum = 25;
  313.         venc_chn_attr.stRcAttr.stH264Vbr.u32SrcFrameRateDen = 1;
  314.         venc_chn_attr.stRcAttr.stH264Vbr.u32SrcFrameRateNum = 25;

  315.         venc_chn_attr.stVencAttr.imageType = IMAGE_TYPE_RGB888; //输入图片的格式,和 VI 输出保持一致
  316.         venc_chn_attr.stVencAttr.u32PicWidth = 1920; //编码图像宽度,单位像素点
  317.         venc_chn_attr.stVencAttr.u32PicHeight = 1080;//编码图像高度,单位像素点
  318.         venc_chn_attr.stVencAttr.u32VirWidth = 1920;//stride 宽度,必须 16 对齐
  319.         venc_chn_attr.stVencAttr.u32VirHeight = 1080 + 8;// stride 高度,必须 16 对齐
  320.         venc_chn_attr.stVencAttr.u32Profile = 77; //编码等级 77,是中级 66,基础等级,100,高级
  321.         ret = RK_MPI_VENC_CreateChn(1, &venc_chn_attr);//创建通道
  322. #endif       
  323.         //设置rga属性
  324.        
  325.         RGA_ATTR_S stRgaAttr;

  326.         stRgaAttr.bEnBufPool = RK_TRUE;
  327.         stRgaAttr.u16BufPoolCnt = 12;
  328.         stRgaAttr.u16Rotaion = 0;
  329.         stRgaAttr.stImgIn.u32X = 0;
  330.         stRgaAttr.stImgIn.u32Y = 0;
  331.         stRgaAttr.stImgIn.imgType = IMAGE_TYPE_NV12;
  332.         stRgaAttr.stImgIn.u32Width = 1920;
  333.         stRgaAttr.stImgIn.u32Height = 1080;
  334.         stRgaAttr.stImgIn.u32HorStride = 1920;
  335.         stRgaAttr.stImgIn.u32VirStride = 1080;

  336.         stRgaAttr.stImgOut.u32X = 0;
  337.         stRgaAttr.stImgOut.u32Y = 0;
  338.         //stRgaAttr.stImgOut.imgType = IMAGE_TYPE_JPEG;
  339.         stRgaAttr.stImgOut.imgType = IMAGE_TYPE_BGR888;
  340.         stRgaAttr.stImgOut.u32Width = 1920;
  341.         stRgaAttr.stImgOut.u32Height = 1080;
  342.         stRgaAttr.stImgOut.u32HorStride = 1920;
  343.         stRgaAttr.stImgOut.u32VirStride = 1080;

  344.         ret = RK_MPI_RGA_CreateChn(0, &stRgaAttr);
  345.         if (ret) {
  346.                 printf("Create rga[0] falied! ret=%d\n", ret);
  347.                 return -1;
  348.         }

  349.         MPP_CHN_S vRgaChn;
  350.         vRgaChn.enModId = RK_ID_RGA;
  351.         vRgaChn.s32DevId = 0;
  352.         vRgaChn.s32ChnId = 0;

  353. /*        ret = RK_MPI_SYS_RegisterOutCb(&vRgaChn, rga_packet_cb); //注册数据输出回调。
  354.         if (ret) {
  355.                 printf("ERROR: register output callback for RGA[0] error! ret=%d\n", ret);
  356.                 return NULL;
  357.         }*/

  358.         pthread_t main_stream_thread;
  359.         pthread_create(&main_stream_thread, NULL, MainStream, NULL);
  360. #ifdef close_mux
  361.         //设置mux属性
  362.         MUXER_CHN_ATTR_S stMuxerAttr;
  363.         memset(&stMuxerAttr, 0, sizeof(stMuxerAttr));
  364.         stMuxerAttr.enMode = MUXER_MODE_AUTOSPLIT;
  365.         stMuxerAttr.enType = MUXER_TYPE_MP4;
  366.         stMuxerAttr.stSplitAttr.enSplitType = MUXER_SPLIT_TYPE_TIME;
  367.         stMuxerAttr.stSplitAttr.u32TimeLenSec = 30;
  368.        
  369.         /*printf("#MuxerTest: use split name auto type...\n");
  370.         stMuxerAttr.stSplitAttr.enSplitNameType = MUXER_SPLIT_NAME_TYPE_AUTO;
  371.         stMuxerAttr.stSplitAttr.stNameAutoAttr.pcPrefix = (RK_CHAR*)"muxer_test";
  372.         stMuxerAttr.stSplitAttr.stNameAutoAttr.pcBaseDir = (RK_CHAR*)"/userdata/data";
  373.         // Split File name with timestamp.
  374.         // stMuxerAttr.stSplitAttr.stNameAutoAttr.bTimeStampEnable = RK_TRUE;
  375.         stMuxerAttr.stSplitAttr.stNameAutoAttr.u16StartIdx = 1;*/

  376.          printf("#MuxerTest: use split name callback type, cb:%p, handle:%p...\n",
  377.            GetRecordFileName, &gu32FileIdx);
  378.             stMuxerAttr.stSplitAttr.enSplitNameType = MUXER_SPLIT_NAME_TYPE_CALLBACK;
  379.             stMuxerAttr.stSplitAttr.stNameCallBackAttr.pcbRequestFileNames = GetRecordFileName;
  380.             stMuxerAttr.stSplitAttr.stNameCallBackAttr.pCallBackHandle =(RK_VOID *)&gu32FileIdx;

  381.         stMuxerAttr.stVideoStreamParam.enCodecType = RK_CODEC_TYPE_H264;
  382.         stMuxerAttr.stVideoStreamParam.enImageType = IMAGE_TYPE_NV12;
  383.         stMuxerAttr.stVideoStreamParam.u16Fps = 25;
  384.         stMuxerAttr.stVideoStreamParam.u16Level = 41;    // for h264
  385.         stMuxerAttr.stVideoStreamParam.u16Profile = 77; // for h264
  386.         stMuxerAttr.stVideoStreamParam.u32BitRate = 1920 * 1080;
  387.         stMuxerAttr.stVideoStreamParam.u32Width = 1920;
  388.         stMuxerAttr.stVideoStreamParam.u32Height = 1080;
  389.         ret = RK_MPI_MUXER_EnableChn(0, &stMuxerAttr);
  390.         if (ret) {
  391.                 printf("Create MUXER[0] failed! ret=%d\n", ret);
  392.                 return -1;
  393.           }
  394.        
  395.         MPP_CHN_S muxerChn;
  396.         MUXER_CHN_S stMuxerChn;
  397.        
  398.         muxerChn.enModId = RK_ID_MUXER;
  399.         muxerChn.s32DevId = 0;
  400.         muxerChn.s32ChnId = 0;
  401.        
  402.         MuxerHandle stMuxerHandle;
  403.         stMuxerHandle.u32ChnIdx = 0;
  404.         stMuxerHandle.u32ModeIdx = RK_ID_MUXER;
  405.        
  406.         ret = RK_MPI_SYS_RegisterEventCb(&muxerChn, &stMuxerHandle, muxer_event_cb);
  407.         if (ret) {
  408.                 printf("Register event callback failed! ret=%d\n", ret);
  409.                 return -1;
  410.         }
  411.        
  412.         printf("### Start muxer stream...\n");
  413.         ret = RK_MPI_MUXER_StreamStart(0);
  414.         if (ret) {
  415.                 printf("Muxer start stream failed! ret=%d\n", ret);
  416.                 return -1;
  417.         }

  418.         // Bind VENC[0] to MUXER[0]:VIDEO
  419.         VencChn.enModId = RK_ID_VENC;
  420.         VencChn.s32DevId = 0;
  421.         VencChn.s32ChnId = 0;
  422.         stMuxerChn.enModId = RK_ID_MUXER;
  423.         stMuxerChn.enChnType = MUXER_CHN_TYPE_VIDEO;
  424.         stMuxerChn.s32ChnId = 0;
  425.         ret = RK_MPI_MUXER_Bind(&VencChn, &stMuxerChn);
  426.         if (ret) {
  427.                 printf("ERROR: Bind VENC[0] and MUXER[0]:VIDEO error! ret=%d\n", ret);
  428.                 return 0;
  429.         }
  430. #endif
  431.         // VDec Bind Rga
  432.         ret = RK_MPI_SYS_Bind(&VdecChn, &vRgaChn);
  433.         if (ret) {
  434.                 printf("ERROR: Bind Vdec[0] and VRGA[0] failed! ret=%d\n");
  435.                 return -1;
  436.         }
  437.         // VDec Bind VENC for save video
  438.         ret = RK_MPI_SYS_Bind(&VdecChn, &VencChn);
  439.         if (ret) {
  440.                 printf("ERROR: Bind Vdec[0] and Venc[0] failed! ret=%d\n");
  441.                 return -1;
  442.         }
  443. #ifdef full_flow
  444.         ret = RK_MPI_SYS_Bind(&vRgaChn, &VencChn1);
  445.         if (ret) {
  446.                 printf("ERROR: Bind VRGA[0] and Venc[1] failed! ret=%d\n");
  447.                 return -1;
  448.         }
  449.         //连接到rtsp推流上
  450. #endif

  451.         //设置流媒体参数
  452.         struct FFRTSPGet ffrtsp_get;
  453.         ffrtsp_get.callback = FFRKMedia_Vdec_Send;
  454.         ffrtsp_get.count = 1;
  455.         ffrtsp_get.ffrtsp_get_info[0].url = (char*)"rtsp://admin:zd123456@192.168.1.5";
  456.         ffrtspGet(ffrtsp_get);
  457.         //设置rtsp推流属性
  458.         //g_rtsplive = create_rtsp_demo(554);
  459.         //g_rtsp_session = rtsp_new_session(g_rtsplive, "/live/main_stream");
  460.         //rtsp_set_video(g_rtsp_session, RTSP_CODEC_ID_VIDEO_H264, NULL, 0);
  461. //        rtsp_sync_video_ts(g_rtsp_session, rtsp_get_reltime(), rtsp_get_ntptime()); //rtsp 同步当前网络时间
  462.         while(!quit)
  463.         {
  464.                 sleep(1);
  465.         }
  466.         if (g_rtsplive)
  467.                 rtsp_del_demo(g_rtsplive);
  468. #ifdef close_mux
  469.         printf("### Stop muxer stream...\n");
  470.         ret = RK_MPI_MUXER_StreamStop(0);
  471.         if (ret) {
  472.                 printf("Muxer stop stream failed! ret=%d\n", ret);
  473.                 return -1;
  474.         }

  475.         // UnBind VENC[0] to MUXER[0]
  476.         VencChn.enModId = RK_ID_VENC;
  477.         VencChn.s32DevId = 0;
  478.         VencChn.s32ChnId = 0;
  479.         stMuxerChn.enModId = RK_ID_MUXER;
  480.         stMuxerChn.enChnType = MUXER_CHN_TYPE_VIDEO;
  481.         stMuxerChn.s32ChnId = 0;
  482.         ret = RK_MPI_MUXER_UnBind(&VencChn, &stMuxerChn);
  483.         if (ret) {
  484.                 printf("ERROR: UnBind VENC[0] and MUXER[0] error! ret=%d\n", ret);
  485.                 return 0;
  486.         }
  487. #endif
  488.         //释放资源
  489. #ifdef full_flow
  490.         RK_MPI_SYS_UnBind(&vRgaChn, &VencChn1);
  491. #endif
  492.         RK_MPI_SYS_UnBind(&VdecChn, &vRgaChn);
  493.         RK_MPI_SYS_UnBind(&VdecChn, &VencChn);
  494. #ifdef full_flow
  495.         RK_MPI_VENC_DestroyChn(1);
  496. #endif
  497.         RK_MPI_VENC_DestroyChn(0);
  498.         RK_MPI_RGA_DestroyChn(0);
  499.         RK_MPI_VDEC_DestroyChn(0);

  500.         return 0;
  501. }



复制代码




回复

使用道具 举报

48

积分

0

威望

0

贡献

技术小白

积分
48
发表于 2021-12-7 10:36:33        只看该作者  沙发

补充张图片,图片上时间戳,静止不动



回复

使用道具 举报

1万

积分

14

威望

13

贡献

管理员

Rank: 9Rank: 9Rank: 9

积分
11182

优秀版主

发表于 2021-12-8 09:28:35        只看该作者  板凳
你是用 librtsp.a 吧?这个是 rockchip 提供的库,好像是有问题,只要输入源不是 VI 就会出现这种情况,但是因为 rockchip 只提供了静态库文件具体什么问题我们也不得而知。你可以自己实现 rtsp 推流,或者用我们的 libffrtsp.so 试一下
回复

使用道具 举报

48

积分

0

威望

0

贡献

技术小白

积分
48
发表于 2021-12-13 22:57:20        只看该作者  地板
板蓝根 发表于 2021-12-8 09:28
你是用 librtsp.a 吧?这个是 rockchip 提供的库,好像是有问题,只要输入源不是 VI 就会出现这种情况,但 ...

使用ffrtsp用VLC打开也卡住了,硬件IP地址配置如下
1、eth0接IP camera设置IP地址192.168.1.25,camera ip为192.168.1.5
2、eth1接PC,设置IP地址10.0.0.6,pc IP为10.0.0.4
3、用VLC打卡地址rtsp://10.0.0.6:8554/H264_stream_0 卡住没有图像。
4、测试代码如下:
  1. #include <assert.h>
  2. #include <fcntl.h>
  3. #include <pthread.h>
  4. #include <signal.h>
  5. #include <stdbool.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <time.h>
  10. #include <unistd.h>
  11. #include <sys/time.h>
  12. #include "common/sample_common.h"
  13. #include "rkmedia_api.h"
  14. #include "rkmedia_vdec.h"
  15. #include "ffrtsp/ffrtsp.hh"




  16. struct RTSP_PUSH_INFO ffrtsp_push[MAXFFRTSPChn];

  17. static bool quit = false;
  18. static void sigterm_handler(int sig) {
  19.         fprintf(stderr, "signal %d\n", sig);
  20.         quit = true;
  21. }

  22. static long getCurrentTimeMsec() {
  23.         long msec = 0;
  24.         char str[20] = {0};
  25.         struct timeval stuCurrentTime;

  26.         gettimeofday(&stuCurrentTime, NULL);
  27.         sprintf(str, "%ld%03ld", stuCurrentTime.tv_sec,(stuCurrentTime.tv_usec) / 1000);
  28.         for (size_t i = 0; i < strlen(str); i++) {
  29.                 msec = msec * 10 + (str[i] - '0');
  30.         }

  31.         return msec;
  32. }



  33. int FFRKMedia_Vdec_Send(u_int8_t* framebuff,unsigned framesize,bool * pquit,int cur_chn)
  34. {
  35.         //RTSP流数据送到decode通道
  36.     MEDIA_BUFFER mb = RK_MPI_MB_CreateBuffer(framesize, RK_FALSE, 0);
  37.     RK_MPI_MB_SetSize(mb, framesize);
  38.     memcpy(RK_MPI_MB_GetPtr(mb) ,framebuff , framesize);
  39.     RK_MPI_MB_SetSize(mb, framesize);
  40.     RK_MPI_SYS_SendMediaBuffer(RK_ID_VDEC, 0, mb);
  41.         //printf("%s\n",__func__);
  42.         if(ffrtsp_push[0].fp == NULL) {
  43.                 continue;
  44.         }
  45.         //printf("%s 1\n",__func__);
  46.         if (RK_MPI_MB_GetPtr(mb) != NULL) {
  47.                 printf("%s\n",__func__);
  48.                 fwrite(RK_MPI_MB_GetPtr(mb), RK_MPI_MB_GetSize(mb), 1, ffrtsp_push[0].fp);
  49.         }
  50.                
  51.     RK_MPI_MB_ReleaseBuffer(mb);
  52.     if (quit)
  53.             *pquit = true;
  54. }
  55. static void *rtsppushbuff(void *data) {
  56.         printf("%s\n",__func__);
  57.         ((struct RTSP_PUSH_INFO *)data)->type = RTSP_CODEC_H264;
  58.         ffrtsph264Push((struct RTSP_PUSH_INFO *)data);
  59. }

  60. int main(int argc, char *argv[])
  61. {
  62.         int ret=0;
  63.          
  64.         signal(SIGINT, sigterm_handler);


  65.         pthread_t rtsppush_thread;

  66.         ffrtsp_push[0].idex = 0;
  67.         ffrtsp_push[0].port = 8554;
  68.         ffrtsp_push[0].type = RK_CODEC_TYPE_H264;
  69.        
  70.         // RTSP 推流线程
  71.         pthread_create(&rtsppush_thread, NULL, rtsppushbuff, (void *)&ffrtsp_push[0]);




  72.         //设置流媒体参数
  73.         struct FFRTSPGet ffrtsp_get;
  74.         ffrtsp_get.callback = FFRKMedia_Vdec_Send;
  75.         ffrtsp_get.count = 1;
  76.         ffrtsp_get.ffrtsp_get_info[0].url = (char*)"rtsp://admin:zd123456@192.168.1.5";
  77.         ffrtspGet(ffrtsp_get);

  78.        
  79.         while(!quit)
  80.         {
  81.                 sleep(1);
  82.         }


  83.         return 0;
  84. }



复制代码
5、log如下:
  1. ./rtsp_test1
  2. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libffrtsp.so)
  3. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libffrtsp.so)
  4. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libffrtsp.so)
  5. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face_engine.so)
  6. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face_engine.so)
  7. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face_engine.so)
  8. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face_engine.so)
  9. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face.so)
  10. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face.so)
  11. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face.so)
  12. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face.so)
  13. ./rtsp_test1: /lib/libstdc++.so.6: no version information available (required by /usr/lib/libarcsoft_face.so)
  14. media get entity by name: rkcif-lvds-subdev is null
  15. media get entity by name: rkcif-lite-lvds-subdev is null
  16. media get entity by name: rkisp-mpfbc-subdev is null
  17. media get entity by name: rkisp_dmapath is null
  18. media get entity by name: rockchip-mipi-dphy-rx is null
  19. Rga built version:1.04 cb973b1+2021-06-01 11:34:20
  20. rtsppushbuff
  21. Created new TCP socket 8 for connection
  22. Connecting to 192.168.1.5, port 554 on socket 8...
  23. Play this stream using the URL "rtsp://10.0.0.6:8554/H264_stream_0"
  24. Beginning streaming...
  25. ...remote connection opened
  26. Sending request: DESCRIBE rtsp://admin:zd123456@192.168.1.5 RTSP/1.0
  27. CSeq: 2
  28. User-Agent: ffrtspGet (LIVE555 Streaming Media v2017.10.28)
  29. Accept: application/sdp


  30. Received 184 new bytes of response data.
  31. Received a complete DESCRIBE response:
  32. RTSP/1.0 401 Unauthorized
  33. CSeq: 2
  34. WWW-Authenticate: Digest realm="IP Camera(F3061)", nonce="32be1bc1d9706735c8a7d0ddeb8fa885", stale="FALSE"
  35. Date:  Mon, Dec 13 2021 22:48:44 GMT


  36. Resending...
  37. Sending request: DESCRIBE rtsp://admin:zd123456@192.168.1.5 RTSP/1.0
  38. CSeq: 3
  39. Authorization: Digest username="admin", realm="IP Camera(F3061)", nonce="32be1bc1d9706735c8a7d0ddeb8fa885", uri="rtsp://admin:zd123456@192.168.1.5", response="7ca4546c386098f11bc4bc79352c5576"
  40. User-Agent: ffrtspGet (LIVE555 Streaming Media v2017.10.28)
  41. Accept: application/sdp


  42. Received 702 new bytes of response data.
  43. Received a complete DESCRIBE response:
  44. RTSP/1.0 200 OK
  45. CSeq: 3
  46. Content-Type: application/sdp
  47. Content-Base: rtsp://admin:zd123456@192.168.1.5/
  48. Content-Length: 572

  49. v=0
  50. o=- 1639435724717783 1639435724717783 IN IP4 192.168.1.5
  51. s=Media Presentation
  52. e=NONE
  53. b=AS:5050
  54. t=0 0
  55. a=control:rtsp://admin:zd123456@192.168.1.5/
  56. m=video 0 RTP/AVP 96
  57. c=IN IP4 0.0.0.0
  58. b=AS:5000
  59. a=recvonly
  60. a=x-dimensions:1920,1080
  61. a=control:rtsp://admin:zd123456@192.168.1.5/trackID=1
  62. a=rtpmap:96 H264/90000
  63. a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AKpY1QPAET8s3AQEBQAABwgAAV+QB,aO4xsg==
  64. a=Media_header:MEDIAINFO=494D4B48010300000400000100000000000000000000000000000000000000000000000000000000;
  65. a=appversion:1.0

  66. [URL:"rtsp://admin:zd123456@192.168.1.5/"]: Got a SDP description:
  67. v=0
  68. o=- 1639435724717783 1639435724717783 IN IP4 192.168.1.5
  69. s=Media Presentation
  70. e=NONE
  71. b=AS:5050
  72. t=0 0
  73. a=control:rtsp://admin:zd123456@192.168.1.5/
  74. m=video 0 RTP/AVP 96
  75. c=IN IP4 0.0.0.0
  76. b=AS:5000
  77. a=recvonly
  78. a=x-dimensions:1920,1080
  79. a=control:rtsp://admin:zd123456@192.168.1.5/trackID=1
  80. a=rtpmap:96 H264/90000
  81. a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AKpY1QPAET8s3AQEBQAABwgAAV+QB,aO4xsg==
  82. a=Media_header:MEDIAINFO=494D4B48010300000400000100000000000000000000000000000000000000000000000000000000;
  83. a=appversion:1.0

  84. [URL:"rtsp://admin:zd123456@192.168.1.5/"]: Initiated the "video/H264" subsession (client ports 59324-59325)
  85. Sending request: SETUP rtsp://admin:zd123456@192.168.1.5/trackID=1 RTSP/1.0
  86. CSeq: 4
  87. Authorization: Digest username="admin", realm="IP Camera(F3061)", nonce="32be1bc1d9706735c8a7d0ddeb8fa885", uri="rtsp://admin:zd123456@192.168.1.5/", response="9347da75e78d0d7f8950b6dab8316ab7"
  88. User-Agent: ffrtspGet (LIVE555 Streaming Media v2017.10.28)
  89. Transport: RTP/AVP;unicast;client_port=59324-59325


  90. Received 204 new bytes of response data.
  91. Received a complete SETUP response:
  92. RTSP/1.0 200 OK
  93. CSeq: 4
  94. Session:        448226533;timeout=60
  95. Transport: RTP/AVP;unicast;client_port=59324-59325;server_port=8222-8223;ssrc=777d88c7;mode="play"
  96. Date:  Mon, Dec 13 2021 22:48:44 GMT


  97. [URL:"rtsp://admin:zd123456@192.168.1.5/"]: Set up the "video/H264" subsession (client ports 59324-59325)
  98. [URL:"rtsp://admin:zd123456@192.168.1.5/"]: Created a data sink for the "video/H264" subsession
  99. Sending request: PLAY rtsp://admin:zd123456@192.168.1.5/ RTSP/1.0
  100. CSeq: 5
  101. Authorization: Digest username="admin", realm="IP Camera(F3061)", nonce="32be1bc1d9706735c8a7d0ddeb8fa885", uri="rtsp://admin:zd123456@192.168.1.5/", response="e2935df5aea2223cfe6517b08beb150c"
  102. User-Agent: ffrtspGet (LIVE555 Streaming Media v2017.10.28)
  103. Session: 448226533
  104. Range: npt=0.000-


  105. Received 180 new bytes of response data.
  106. Received a complete PLAY response:
  107. RTSP/1.0 200 OK
  108. CSeq: 5
  109. Session:        448226533
  110. RTP-Info: url=rtsp://admin:zd123456@192.168.1.5/trackID=1;seq=47568;rtptime=417018600
  111. Date:  Mon, Dec 13 2021 22:48:44 GMT


  112. [URL:"rtsp://admin:zd123456@192.168.1.5/"]: Started playing session...
  113. FFRKMedia_Vdec_Send
  114. FFRKMedia_Vdec_Send
  115. FFRKMedia_Vdec_Send
  116. FFRKMedia_Vdec_Send
  117. FFRKMedia_Vdec_Send
  118. FFRKMedia_Vdec_Send
  119. FFRKMedia_Vdec_Send
  120. FFRKMedia_Vdec_Send
  121. FFRKMedia_Vdec_Send
  122. FFRKMedia_Vdec_Send
  123. FFRKMedia_Vdec_Send
  124. FFRKMedia_Vdec_Send
  125. FFRKMedia_Vdec_Send
  126. FFRKMedia_Vdec_Send
  127. FFRKMedia_Vdec_Send
  128. FFRKMedia_Vdec_Send
  129. FFRKMedia_Vdec_Send
  130. FFRKMedia_Vdec_Send
  131. FFRKMedia_Vdec_Send
  132. FFRKMedia_Vdec_Send
  133. FFRKMedia_Vdec_Send
  134. FFRKMedia_Vdec_Send
  135. FFRKMedia_Vdec_Send
  136. FFRKMedia_Vdec_Send
  137. FFRKMedia_Vdec_Send
  138. FFRKMedia_Vdec_Send
  139. FFRKMedia_Vdec_Send
  140. FFRKMedia_Vdec_Send
  141. FFRKMedia_Vdec_Send
  142. FFRKMedia_Vdec_Send
  143. FFRKMedia_Vdec_Send
  144. FFRKMedia_Vdec_Send
  145. FFRKMedia_Vdec_Send
  146. FFRKMedia_Vdec_Send
  147. FFRKMedia_Vdec_Send
  148. FFRKMedia_Vdec_Send
复制代码




回复

使用道具 举报

1万

积分

14

威望

13

贡献

管理员

Rank: 9Rank: 9Rank: 9

积分
11182

优秀版主

发表于 2021-12-14 09:41:32        只看该作者  5#
没看到有解码器初始化和流发送啊,代码是不是贴漏了?先从下面方式排查一下。
1. 去掉解码步骤,ffrtsp_get 回调获取到的 buff 直接额送到 ffrtsp_push,确认一下是不是 rtsp 配置问题。ffrtsp_demo_test.cpp
2. ffrtsp 后直接保留 h264 文件/ Vdec 解码后保留 NV12 / VENC 编码后保留 H264 来确认哪个步骤出了问题
回复

使用道具 举报

48

积分

0

威望

0

贡献

技术小白

积分
48
发表于 2021-12-14 17:31:28        只看该作者  6#
板蓝根 发表于 2021-12-14 09:41
没看到有解码器初始化和流发送啊,代码是不是贴漏了?先从下面方式排查一下。
1. 去掉解码步骤,ffrtsp_ge ...

没用解码器,IP camera获得的流就是H264编码,NV12的,直接推流到另一个网口的
回复

使用道具 举报

1万

积分

14

威望

13

贡献

管理员

Rank: 9Rank: 9Rank: 9

积分
11182

优秀版主

发表于 2021-12-15 09:31:21        只看该作者  7#
ffrtsp_get 之后 fwrite 本地文件保存的文件可以播放吗? 直接跑 ffrtsp_demo_test 可以出流吗? 其次可以用 gdb 等调试手段调式一下呀
回复

使用道具 举报

48

积分

0

威望

0

贡献

技术小白

积分
48
发表于 2021-12-26 22:46:14        只看该作者  8#
板蓝根 发表于 2021-12-15 09:31
ffrtsp_get 之后 fwrite 本地文件保存的文件可以播放吗? 直接跑 ffrtsp_demo_test 可以出流吗? 其次可以 ...

使用ffrtsp_demo_test测试也是出不了流,请教下2个问题
1、我打开了SAVE_FILE配置保存为test_rtsp_0,用什么工具打开,我直接拖到VLC上打不开
2、我刚开始的测试代码,偶尔也打开过,想问下是不是需要 网口需要设置路由之类,请问下你们网卡怎么配置的,我在开机启动上以下命令:ifconfig eth0 10.0.0.6 netmask 255.255.255.0;ifconfig eth1 192.168.1.25 netmask 255.255.255.0
回复

使用道具 举报

1万

积分

14

威望

13

贡献

管理员

Rank: 9Rank: 9Rank: 9

积分
11182

优秀版主

发表于 2021-12-27 09:40:40        只看该作者  9#
1. ffplay 和 vlc 都可以播放,ffplay 要把文件后缀改成 .264 才可以。
2. 双网卡的话有可能是网关的问题,建议你先把一张网卡down 掉,PC 先 ping 通在测试。
回复

使用道具 举报

74

积分

0

威望

0

贡献

技术小白

积分
74
发表于 2022-2-14 17:22:25        只看该作者  10#
chien126 发表于 2021-12-26 22:46
使用ffrtsp_demo_test测试也是出不了流,请教下2个问题
1、我打开了SAVE_FILE配置保存为test_rtsp_0,用 ...

这个可以拉音频么~
回复

使用道具 举报

返回列表
12
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

友情链接 : 爱板网 电子发烧友论坛 云汉电子社区 粤ICP备14022046号-2
快速回复 返回顶部 返回列表