Skip to content

playerC/ffmpeg_rtppipe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

107,066 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
FFmepg rtppipe
==============

添加 rtppipe 支持从stdin接收RTP视频数据.

Add rtppipe support to recieve RTP video data from stdin.

Liscense : See LICENSE.md
Copyright (c) 2026 playerc@msn.cn

用法 Usage
==========

如需要把 WebRTC 中的RTP视频流保存成视频文件,在代码中运行一下命令,并
获取到STDIN作为 videoStream.

To save an RTP video stream from WebRTC to a video file, run the
following command in your code and obtain STDIN as the videoStream.

::
  ffmpeg -protocol_whitelist rtp,pipe,file,udp -f sdp_pipe \
  -reorder_queue_size 9999 -i tests/test.sdp -f flv testr.flv

设置 WebRTC onMessage:

Setup WebRTC onMessage:

::
  this.track.onMessage((msg) => {
    if (this.startRecord == true){
      let rtppipeHead = Buffer.allocUnsafe(6);

      rtppipeHead.writeUInt8(0x24, 0);
      rtppipeHead.writeUInt8(0, 1);
      rtppipeHead.writeUInt16BE(msg.length, 2);
      rtppipeHead.writeUInt16BE(0, 4);// not used
      
      this.videoStream.write(rtppipeHead);
      this.videoStream.write(msg);
    }
  });
  
向 videoStream 发送 EOF 即可结束录制.

Sending EOF to the videoStream will stop the recording.

如何设置SDP文件  How to config SDP file
=======================================

是的,你必须按需修改SDP文件,也就是案例中的 `test.sdp` 文件. 以下是示
例,请按需求修改,使用时请移除注释.

Yes, you must modify the SDP file as needed—in this case, the test.sdp
file. Below is an example; please adjust it according to your
requirements and remove the comments before use.

::
  SDP:
  v=0
  o=- 0 0 IN IP6 ::1
  s=No Name
  c=IN PIPE6 ::1     /* use rtppipe on localhost */
  t=0 0
  a=tool:libavformat LIBAVFORMAT_VERSION
  m=video 8888 RTP/AVP 96   /* !!! RTP video port. (RTSP use this PORT+1 ) */
  a=rtpmap:96 H264/90000
  a=fmtp:96 packetization-mode=1

如何构建 How to build
=====================

See INSTALL.md

:~ EOF

About

add rtp_pipe input to support to get RTP input from stdin with RTCP enabled.

Topics

Resources

License

Unknown and 4 other licenses found

Licenses found

Unknown
LICENSE.md
GPL-2.0
COPYING.GPLv2
GPL-3.0
COPYING.GPLv3
LGPL-2.1
COPYING.LGPLv2.1
LGPL-3.0
COPYING.LGPLv3

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors