Simple Live System Using SRS

https://www.cnblogs.com/dong1/p/5100792.html

1、上面是推送文件,改成推送缓存

封装了三个函数

int srs_librtmp_connect(srs_rtmp_t rtmp);
int srs_librtmp_push(srs_rtmp_t rtmp, char* h264_raw, off_t file_size, double fps);
int srs_librtmp_close(srs_rtmp_t rtmp);

  1. /*
  2. The MIT License (MIT)
  3.  
  4. Copyright (c) 2013-2015 SRS(ossrs)
  5.  
  6. Permission is hereby granted, free of charge, to any person obtaining a copy of
  7. this software and associated documentation files (the "Software"), to deal in
  8. the Software without restriction, including without limitation the rights to
  9. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  10. the Software, and to permit persons to whom the Software is furnished to do so,
  11. subject to the following conditions:
  12.  
  13. The above copyright notice and this permission notice shall be included in all
  14. copies or substantial portions of the Software.
  15.  
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18. FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19. COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20. IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. /**
  24. gcc srs_h264_raw_publish.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_h264_raw_publish
  25. */
  26.  
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <unistd.h>
  30.  
  31. // for open h264 raw file.
  32. #include <sys/types.h>
  33. #include <sys/stat.h>
  34. #include <fcntl.h>
  35.  
  36. #include "srs_librtmp.h"
  37.  
  38. static off_t file_size;
  39.  
  40. int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fps,
  41. char** frame, int* frame_size, int* dts, int* pts)
  42. {
  43. char* p = *pp;
  44.  
  45. // @remark, for this demo, to publish h264 raw file to SRS,
  46. // we search the h264 frame from the buffer which cached the h264 data.
  47. // please get h264 raw data from device, it always a encoded frame.
  48. if (!srs_h264_startswith_annexb(p, size - (p - data), pnb_start_code)) {
  49. srs_human_trace("h264 raw data invalid.");
  50. return -;
  51. }
  52.  
  53. // @see srs_write_h264_raw_frames
  54. // each frame prefixed h.264 annexb header, by N[00] 00 00 01, where N>=0,
  55. // for instance, frame = header(00 00 00 01) + payload(67 42 80 29 95 A0 14 01 6E 40)
  56. *frame = p;
  57. p += *pnb_start_code;
  58.  
  59. for (;p < data + size; p++) {
  60. if (srs_h264_startswith_annexb(p, size - (p - data), NULL)) {
  61. break;
  62. }
  63. }
  64.  
  65. *pp = p;
  66. *frame_size = p - *frame;
  67. if (*frame_size <= ) {
  68. srs_human_trace("h264 raw data invalid.");
  69. return -;
  70. }
  71.  
  72. // @remark, please get the dts and pts from device,
  73. // we assume there is no B frame, and the fps can guess the fps and dts,
  74. // while the dts and pts must read from encode lib or device.
  75. *dts += / fps;
  76. *pts = *dts;
  77.  
  78. return ;
  79. }
  80.  
  81. int srs_librtmp_connect(srs_rtmp_t rtmp)
  82. {
  83. if (srs_rtmp_handshake(rtmp) != ) {
  84. srs_human_trace("simple handshake failed.");
  85. return -;
  86. }
  87. srs_human_trace("simple handshake success");
  88.  
  89. if (srs_rtmp_connect_app(rtmp) != ) {
  90. srs_human_trace("connect vhost/app failed.");
  91. return -;
  92. }
  93. srs_human_trace("connect vhost/app success");
  94.  
  95. if (srs_rtmp_publish_stream(rtmp) != ) {
  96. srs_human_trace("publish stream failed.");
  97. return -;
  98. }
  99. srs_human_trace("publish stream success");
  100.  
  101. return ;
  102. }
  103.  
  104. char* get_data_frame(void)
  105. {
  106. const char* raw_file = "./720p.h264.raw";
  107. // open file
  108. int raw_fd = open(raw_file, O_RDONLY);
  109. if (raw_fd < ) {
  110. srs_human_trace("open h264 raw file %s failed.", raw_file);
  111. return NULL;
  112. }
  113.  
  114. file_size = lseek(raw_fd, , SEEK_END);
  115. if (file_size <= ) {
  116. srs_human_trace("h264 raw file %s empty.", raw_file);
  117. return NULL;
  118. }
  119. //srs_human_trace("read entirely h264 raw file, size=%dKB", (int)(file_size / 1024));
  120.  
  121. char*h264_raw = (char*)malloc(file_size);
  122. if (!h264_raw) {
  123. srs_human_trace("alloc raw buffer failed for file %s.", raw_file);
  124. return NULL;
  125. }
  126.  
  127. lseek(raw_fd, , SEEK_SET);
  128. ssize_t nb_read = ;
  129. if ((nb_read = read(raw_fd, h264_raw, file_size)) != file_size) {
  130. srs_human_trace("buffer %s failed, expect=%dKB, actual=%dKB.",
  131. raw_file, (int)(file_size / ), (int)(nb_read / ));
  132. return NULL;
  133. }
  134.  
  135. close(raw_fd);
  136.  
  137. return h264_raw;
  138. }
  139.  
  140. int srs_librtmp_push(srs_rtmp_t rtmp, char* h264_raw, off_t file_size, double fps)
  141. {
  142. int dts = ;
  143. int pts = ;
  144. // @remark, to decode the file.
  145. char* p = h264_raw;
  146. int count = ;
  147. //while(1){
  148. for (; p < h264_raw + file_size;) {
  149. // @remark, read a frame from file buffer.
  150. char* data = NULL;
  151. int size = ;
  152. int nb_start_code = ;
  153. if (read_h264_frame(h264_raw, (int)file_size, &p, &nb_start_code, fps, &data, &size, &dts, &pts) < ) {
  154. srs_human_trace("read a frame from file buffer failed.");
  155. return -;
  156. }
  157.  
  158. // send out the h264 packet over RTMP
  159. int ret = srs_h264_write_raw_frames(rtmp, data, size, dts, pts);
  160. if (ret != ) {
  161. if (srs_h264_is_dvbsp_error(ret)) {
  162. srs_human_trace("ignore drop video error, code=%d", ret);
  163. } else if (srs_h264_is_duplicated_sps_error(ret)) {
  164. srs_human_trace("ignore duplicated sps, code=%d", ret);
  165. } else if (srs_h264_is_duplicated_pps_error(ret)) {
  166. srs_human_trace("ignore duplicated pps, code=%d", ret);
  167. } else {
  168. srs_human_trace("send h264 raw data failed. ret=%d", ret);
  169. return -;
  170. }
  171. }
  172.  
  173. // 5bits, 7.3.1 NAL unit syntax,
  174. // H.264-AVC-ISO_IEC_14496-10.pdf, page 44.
  175. // 7: SPS, 8: PPS, 5: I Frame, 1: P Frame, 9: AUD, 6: SEI
  176. u_int8_t nut = (char)data[nb_start_code] & 0x1f;
  177. srs_human_trace("sent packet: type=%s, time=%d, size=%d, fps=%.2f, b[%d]=%#x(%s)",
  178. srs_human_flv_tag_type2string(SRS_RTMP_TYPE_VIDEO), dts, size, fps, nb_start_code, (char)data[nb_start_code],
  179. (nut == ? "SPS":(nut == ? "PPS":(nut == ? "I":(nut == ? "P":(nut == ? "AUD":(nut == ? "SEI":"Unknown")))))));
  180.  
  181. // @remark, when use encode device, it not need to sleep.
  182. if (count++ == ) {
  183. usleep( * * count / fps);
  184. count = ;
  185. }
  186. }
  187. srs_human_trace("h264 raw data completed");
  188. p = h264_raw;
  189. //}
  190.  
  191. return ;
  192. }
  193.  
  194. int srs_librtmp_close(srs_rtmp_t rtmp)
  195. {
  196. srs_rtmp_destroy(rtmp);
  197. return ;
  198. }
  199.  
  200. int main(int argc, char** argv)
  201. {
  202. printf("publish raw h.264 as rtmp stream to server like FMLE/FFMPEG/Encoder\n");
  203. printf("SRS(ossrs) client librtmp library.\n");
  204. printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
  205.  
  206. const char* rtmp_url = "rtmp://127.0.0.1:1935/live/livestream";
  207.  
  208. srs_rtmp_t rtmp = srs_rtmp_create(rtmp_url);
  209.  
  210. srs_librtmp_connect(rtmp);
  211.  
  212. double fps = ;
  213. char* h264_raw = get_data_frame();
  214.  
  215. while(){
  216. srs_librtmp_push(rtmp,h264_raw,file_size,fps);
  217. }
  218.  
  219. srs_librtmp_close(rtmp);
  220.  
  221. free(h264_raw);
  222.  
  223. return ;
  224. }

gcc srs_h264_raw_publish.c -I $(pwd)/srs-librtmp/include ./srs-librtmp/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_h264_raw_publish

./srs_h264_raw_publish

2、上面是为了省事,直接一堆缓存让read_h264_frame去解出h264数据nalu,再推送,基本没什么实用价值。

正儿八经做了个demo,一帧一帧推送数据

https://files.cnblogs.com/files/dong1/srs-librtmp_pusher_demo.zip

直接srs-librtmp.c源码参与编译的demo

https://files.cnblogs.com/files/dong1/srs-librtmp_demo.zip

3、h264推送规则看文档描述如下

/**
For the example file:
    http://winlinvip.github.io/srs.release/3rdparty/720p.h264.raw
The data sequence is:
    // SPS
    000000016742802995A014016E40
    // PPS
    0000000168CE3880
    // IFrame
    0000000165B8041014C038008B0D0D3A071.....
    // PFrame
    0000000141E02041F8CDDC562BBDEFAD2F.....
User can send the SPS+PPS, then each frame:
    // SPS+PPS
    srs_h264_write_raw_frames('000000016742802995A014016E400000000168CE3880', size, dts, pts)
    // IFrame
    srs_h264_write_raw_frames('0000000165B8041014C038008B0D0D3A071......', size, dts, pts)
    // PFrame
    srs_h264_write_raw_frames('0000000141E02041F8CDDC562BBDEFAD2F......', size, dts, pts)
User also can send one by one:
    // SPS
    srs_h264_write_raw_frames('000000016742802995A014016E4', size, dts, pts)
    // PPS
    srs_h264_write_raw_frames('00000000168CE3880', size, dts, pts)
    // IFrame
    srs_h264_write_raw_frames('0000000165B8041014C038008B0D0D3A071......', size, dts, pts)
    // PFrame
    srs_h264_write_raw_frames('0000000141E02041F8CDDC562BBDEFAD2F......', size, dts, pts)
*/

我们设备的数据sps+pps+i是合成一帧的,直接按 (sps+pps+i合成一帧) + p*n 来推送也是可行了,只是报了个pps错误,不影响。

  1. /**
  2. # Example to use srs-librtmp
  3. # see: https://github.com/ossrs/srs/wiki/v2_CN_SrsLibrtmp
  4. gcc example.c srs_librtmp.cpp -g -O0 -lstdc++ -o example
  5. */
  6.  
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <unistd.h>
  10. #include <sys/types.h>
  11. #include <sys/stat.h>
  12. #include <fcntl.h>
  13.  
  14. #include "srs_librtmp.h"
  15.  
  16. static off_t file_size;
  17.  
  18. char* get_data_frame(char* raw_file)
  19. {
  20. int raw_fd = open(raw_file, O_RDONLY);
  21. if (raw_fd < ) {
  22. srs_human_trace("open h264 raw file %s failed.", raw_file);
  23. return NULL;
  24. }
  25.  
  26. file_size = lseek(raw_fd, , SEEK_END);
  27. if (file_size <= ) {
  28. srs_human_trace("h264 raw file %s empty.", raw_file);
  29. return NULL;
  30. }
  31. //srs_human_trace("read entirely h264 raw file, size=%dKB", (int)(file_size / 1024));
  32.  
  33. char*h264_raw = (char*)malloc(file_size);
  34. if (!h264_raw) {
  35. srs_human_trace("alloc raw buffer failed for file %s.", raw_file);
  36. return NULL;
  37. }
  38.  
  39. lseek(raw_fd, , SEEK_SET);
  40. ssize_t nb_read = ;
  41. if ((nb_read = read(raw_fd, h264_raw, file_size)) != file_size) {
  42. srs_human_trace("buffer %s failed, expect=%dKB, actual=%dKB.",
  43. raw_file, (int)(file_size / ), (int)(nb_read / ));
  44. return NULL;
  45. }
  46.  
  47. close(raw_fd);
  48.  
  49. return h264_raw;
  50. }
  51.  
  52. int main(int argc, char** argv)
  53. {
  54. printf("Example for srs-librtmp\n");
  55. printf("SRS(ossrs) client librtmp library.\n");
  56. printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
  57.  
  58. // connect rtmp context
  59. const char* rtmp_url = "rtmp://127.0.0.1:1935/live/livestream";
  60. srs_rtmp_t rtmp = srs_rtmp_create(rtmp_url);
  61.  
  62. if (srs_rtmp_handshake(rtmp) != ) {
  63. srs_human_trace("simple handshake failed.");
  64. goto rtmp_destroy;
  65. }
  66. srs_human_trace("simple handshake success");
  67.  
  68. if (srs_rtmp_connect_app(rtmp) != ) {
  69. srs_human_trace("connect vhost/app failed.");
  70. goto rtmp_destroy;
  71. }
  72. srs_human_trace("connect vhost/app success");
  73.  
  74. if (srs_rtmp_publish_stream(rtmp) != ) {
  75. srs_human_trace("publish stream failed.");
  76. goto rtmp_destroy;
  77. }
  78. srs_human_trace("publish stream success");
  79.  
  80. int n = ;
  81. int dts = ;
  82. int pts = ;
  83. double fps = ;
  84.  
  85. while(){
  86.  
  87. char str[];
  88. sprintf(str,"./h264_nalu_frame/test%d.264",n);
  89. char* h264_raw = get_data_frame(str);
  90.  
  91. if(h264_raw != NULL){
  92. // send out the h264 packet over RTMP
  93. int ret = srs_h264_write_raw_frames(rtmp, h264_raw, file_size, dts, pts);
  94. if (ret != ) {
  95. if (srs_h264_is_dvbsp_error(ret)) {
  96. srs_human_trace("ignore drop video error, code=%d", ret);
  97. } else if (srs_h264_is_duplicated_sps_error(ret)) {
  98. srs_human_trace("ignore duplicated sps, code=%d", ret);
  99. } else if (srs_h264_is_duplicated_pps_error(ret)) {
  100. srs_human_trace("ignore duplicated pps, code=%d", ret);
  101. } else {
  102. srs_human_trace("send h264 raw data failed. ret=%d", ret);
  103. goto rtmp_destroy;
  104. }
  105. }
  106. }
  107. else break;
  108.  
  109. dts += / fps;
  110. pts = dts;
  111. usleep( * );
  112.  
  113. free(h264_raw);
  114. if(++n > ) n=;
  115. }
  116.  
  117. rtmp_destroy:
  118. srs_rtmp_destroy(rtmp);
  119.  
  120. return ;
  121. }

https://files.cnblogs.com/files/dong1/srs-librtmp_single.zip

4、推送多路rtmp流 ,还是一帧一帧的发送

  1. /**
  2. # Example to use srs-librtmp
  3. # see: https://github.com/ossrs/srs/wiki/v2_CN_SrsLibrtmp
  4. gcc example.c srs_librtmp.cpp -g -O0 -lstdc++ -o example
  5. */
  6.  
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <unistd.h>
  10. #include <assert.h>
  11. #include <fcntl.h>
  12. #include <pthread.h>
  13. #include <sys/types.h>
  14. #include <sys/stat.h>
  15.  
  16. #include "srs_librtmp.h"
  17. #include "threadpool.h"
  18.  
  19. #define THREAD 32
  20. #define QUEUE 256
  21.  
  22. #define THREAD_POOL_EN (0)
  23.  
  24. static off_t file_size;
  25. pthread_mutex_t lock;
  26.  
  27. char* get_data_frame(char* raw_file)
  28. {
  29. int raw_fd = open(raw_file, O_RDONLY);
  30. if (raw_fd < ) {
  31. srs_human_trace("open h264 raw file %s failed.", raw_file);
  32. return NULL;
  33. }
  34.  
  35. file_size = lseek(raw_fd, , SEEK_END);
  36. if (file_size <= ) {
  37. srs_human_trace("h264 raw file %s empty.", raw_file);
  38. return NULL;
  39. }
  40. //srs_human_trace("read entirely h264 raw file, size=%dKB", (int)(file_size / 1024));
  41.  
  42. char*h264_raw = (char*)malloc(file_size);
  43. if (!h264_raw) {
  44. srs_human_trace("alloc raw buffer failed for file %s.", raw_file);
  45. return NULL;
  46. }
  47.  
  48. lseek(raw_fd, , SEEK_SET);
  49. ssize_t nb_read = ;
  50. if ((nb_read = read(raw_fd, h264_raw, file_size)) != file_size) {
  51. srs_human_trace("buffer %s failed, expect=%dKB, actual=%dKB.",
  52. raw_file, (int)(file_size / ), (int)(nb_read / ));
  53. return NULL;
  54. }
  55.  
  56. close(raw_fd);
  57.  
  58. return h264_raw;
  59. }
  60.  
  61. #if THREAD_POOL_EN
  62. void sink_task(void *arg)
  63. #else
  64. void* sink_task(void *arg)
  65. #endif
  66. {
  67. int num = *(int*)arg;
  68. printf("Example for srs-librtmp\n");
  69. printf("SRS(ossrs) client librtmp library.\n");
  70. printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
  71.  
  72. int n = ;
  73. int dts = ;
  74. int pts = ;
  75. double fps = ;
  76.  
  77. // connect rtmp context
  78. const char* rtmp_url = "rtmp://127.0.0.1:1935/live/livestream";
  79. char url[]={};
  80. sprintf(url,"%s%d",rtmp_url,num);
  81. printf("%s\n",url);
  82. srs_rtmp_t rtmp = srs_rtmp_create(url);
  83.  
  84. if (srs_rtmp_handshake(rtmp) != ) {
  85. srs_human_trace("simple handshake failed.");
  86. goto rtmp_destroy;
  87. }
  88. srs_human_trace("simple handshake success");
  89.  
  90. if (srs_rtmp_connect_app(rtmp) != ) {
  91. srs_human_trace("connect vhost/app failed.");
  92. goto rtmp_destroy;
  93. }
  94. srs_human_trace("connect vhost/app success");
  95.  
  96. if (srs_rtmp_publish_stream(rtmp) != ) {
  97. srs_human_trace("publish stream failed.");
  98. goto rtmp_destroy;
  99. }
  100. srs_human_trace("publish stream success");
  101.  
  102. while(){
  103.  
  104. char str[];
  105. sprintf(str,"./h264_nalu_frame/test%d.264",n);
  106. pthread_mutex_lock(&lock);
  107. char* h264_raw = get_data_frame(str);
  108. pthread_mutex_unlock(&lock);
  109.  
  110. if(h264_raw != NULL){
  111. // send out the h264 packet over RTMP
  112. int ret = srs_h264_write_raw_frames(rtmp, h264_raw, file_size, dts, pts);
  113. if (ret != ) {
  114. if (srs_h264_is_dvbsp_error(ret)) {
  115. srs_human_trace("ignore drop video error, code=%d", ret);
  116. } else if (srs_h264_is_duplicated_sps_error(ret)) {
  117. srs_human_trace("ignore duplicated sps, code=%d", ret);
  118. } else if (srs_h264_is_duplicated_pps_error(ret)) {
  119. srs_human_trace("ignore duplicated pps, code=%d", ret);
  120. } else {
  121. srs_human_trace("send h264 raw data failed. ret=%d", ret);
  122. goto rtmp_destroy;
  123. }
  124. }
  125. }
  126. else break;
  127.  
  128. dts += / fps;
  129. pts = dts;
  130. usleep( * );
  131.  
  132. free(h264_raw);
  133. if(++n > ) n=;
  134. }
  135.  
  136. rtmp_destroy:
  137. srs_rtmp_destroy(rtmp);
  138.  
  139. }
  140.  
  141. void source_task(void *arg){
  142. }
  143.  
  144. void* signal_task(void *arg) {
  145.  
  146. threadpool_t *pool;
  147.  
  148. assert((pool = threadpool_create(THREAD, QUEUE, )) != NULL);
  149. fprintf(stderr, "Pool started with %d threads and "
  150. "queue size of %d\n", THREAD, QUEUE);
  151.  
  152. pthread_mutex_init(&lock, NULL);
  153.  
  154. #if THREAD_POOL_EN
  155. if(threadpool_add(pool, &source_task, NULL, ) == ) {
  156. }
  157.  
  158. int num = ;
  159. if(threadpool_add(pool, &sink_task, &num, ) == ) {
  160. }
  161.  
  162. int num1 = ;
  163. if(threadpool_add(pool, &sink_task, &num1, ) == ) {
  164. }
  165.  
  166. int num2 = ;
  167. if(threadpool_add(pool, &sink_task, &num2, ) == ) {
  168. }
  169.  
  170. #else
  171.  
  172. pthread_t rtmp_id,rtmp_id1,rtmp_id2;
  173.  
  174. int num = ;
  175.  
  176. int ret = pthread_create(&rtmp_id,NULL,sink_task, &num);
  177. if(ret!=)
  178. {
  179. printf("Create pthread error!\n");
  180. }
  181.  
  182. int num1 = ;
  183. ret = pthread_create(&rtmp_id1,NULL,sink_task, &num1);
  184. if(ret!=)
  185. {
  186. printf("Create pthread error!\n");
  187. }
  188.  
  189. int num2 = ;
  190. ret = pthread_create(&rtmp_id2,NULL,sink_task, &num2);
  191. if(ret!=)
  192. {
  193. printf("Create pthread error!\n");
  194. }
  195. #endif
  196.  
  197. while()
  198. {
  199. sleep();
  200. }
  201.  
  202. assert(threadpool_destroy(pool, ) == );
  203.  
  204. }
  205.  
  206. int main(int argc, char** argv)
  207. {
  208. pthread_t signal_id;
  209. int ret = pthread_create(&signal_id,NULL,signal_task, NULL);
  210. if(ret!=)
  211. {
  212. return -;
  213. }
  214.  
  215. while()
  216. {
  217. sleep();
  218. }
  219.  
  220. return ;
  221.  
  222. }

https://files.cnblogs.com/files/dong1/srs-librtmp_multiple.zip

end

srs-librtmp pusher(push h264 raw)的更多相关文章

  1. srs(srs-librtmp推送h264原始数据)

    1.下载最新srs源码 https://github.com/ossrs/srs/releases 2.编译(进入~/srs-2.0-r4/trunk目录) ./configure --with-li ...

  2. Push h.264 rawdata to rtmp server

    Push h.264 rawdata to rtmp server /* The MIT License (MIT) Copyright (c) 2013-2015 SRS(ossrs) Permis ...

  3. 海康摄像机使用GB28181接入SRS服务器的搭建步骤---源码安装的方式

    下载代码 地址:https://github.com/ossrs/srs-gb28181 https://github.com/ossrs/srs-gb28181.git 注意:使用的是含有gb281 ...

  4. docker push 实现过程

    这一篇文章分析一下docker push的过程:docker push是将本地的镜像上传到registry service的过程: 根据前几篇文章,可以知道客户端的命令是在api/client/pus ...

  5. RTP协议全解析(H264码流和PS流)

    转自:http://blog.csdn.net/chen495810242/article/details/39207305 写在前面:RTP的解析,网上找了很多资料,但是都不全,所以我力图整理出一个 ...

  6. (转)RTP协议全解(H264码流和PS流)

    写在前面:RTP的解析,网上找了很多资料,但是都不全,所以我力图整理出一个比较全面的解析, 其中借鉴了很多文章,我都列在了文章最后,在此表示感谢. 互联网的发展离不开大家的无私奉献,我决定从我做起,希 ...

  7. RTP协议全解(H264码流和PS流)

    写在前面:RTP的解析,网上找了很多资料,但是都不全,所以我力图整理出一个比较全面的解析, 其中借鉴了很多文章,我都列在了文章最后,在此表示感谢. 互联网的发展离不开大家的无私奉献,我决定从我做起,希 ...

  8. H264 NALU 使用PS封装 RTP发送

    最近由于项目平台需求,要将H264 NALU封装为PS再用RTP发送,PS封装按照ISO DEC-13818-1标准.一个PS包包含PS Header, PES Header, PS system h ...

  9. RTP Payload Format for H264 Video

    基础传输结构 rtp中对于h264数据的存储分为两层,分别是 VCL: video coding layer 视频编码层 这是h264中block, macro block 以及 slice级别的定义 ...

随机推荐

  1. BP算法演示

    本文转载自https://mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example/ Background Backpropaga ...

  2. 二、angular7的基础知识学习

    <p> hello works </p> <div *ngIf="isShow">我是测试内容</div> <p> &l ...

  3. Sign on Fence(连续的长为W的一段中最小的数字的最大值)

    题目链接:http://codeforces.com/problemset/problem/484/E 题意:给你个n,n个木板都有高度,宽度都为1 ,给你两个数[l,r]和一个w,求在[l,r]区间 ...

  4. IE等浏览器兼容问题解决方案

    <meta http-equiv="X-UA-Compatible" content="IE=100" /> 在<head>标签中添加.

  5. leetcode-mid-array-5. Longest Palindromic Substring

    mycode   12.51% class Solution(object): def longestPalindrome(self, s): """ :type s: ...

  6. 邻近双线性插值图像缩放的Python实现

    最近在查找有关图像缩放之类的算法,因工作中需要用到诸如此类的图像处理算法就在网上了解了一下相关算法,以及其原理,并用Python实现,且亲自验证过,在次与大家分享. 声明:本文代码示例针对的是plan ...

  7. 关于linux中移动目录和到指定目录和移动目录中的数据到指定目录

    #这里表示将目录node-v12.13.1-linux-x64移动到/usr/local/中重命名为node,所以node目录可以不存在[root@alone ~]# mv node-v12.13.1 ...

  8. PHP图片处理

    开启GD扩展(php_gd2.dll) 创建画布 画布:一种资源型数据,可以操作的图像资源. 创建新画布(新建) ImageCreate(宽,高);创建基于调色板的画布. imageCreateTru ...

  9. 阿里云ipv6安全组匹配所有ip的方法

    IPv4和IPv6通信彼此独立.您需要为ECS实例单独配置IPv6安全组规则. 操作步骤 登录ECS控制台. 在左侧导航栏,单击网络和安全 > 安全组. 找到目标安全组,然后单击配置规则. 单击 ...

  10. mysql 添加外键报错:

    1.报错信息 Cannot add or update a child row: a foreign key constraint fails 2.原因分析 [1]字段的数据类型 父表: 子表: 以上 ...