Comments (1)
First of all you are only encoding video, but not sending audio because you inserted a "tee" which makes multiple muxers, but then only are using the video stream part. The payload type also does not look right, should be 103 I think?
Anyways, to send video via rtp you would use this:
`//video stream to rtp
const vmux = await beamcoder.muxer({
format_name: 'rtp'
});
vmux.newStream(demux.streams[0]); // get stream from demuxer or make a new one
await vmux.openIO({
url: 'rtp://192.168.1.100:10090' + '?rtcpport=' // where to send the stream remove rtcp part if not needed
});
await vmux.writeHeader({
payload_type: 103, // IMPORTANT. libav sets a default of -1 for the payload type, webrtc does not like that
ssrc: 1111, // stream identifier, can be any positive integer number (must be expected by your webrtc implementation)
});
let vDiff;
while (true) {
const packet = await demux.read();
// video packets
if (packet.stream_index === 0) {
if (!vDiff) vDiff = packet.pts; // if first packet is > 0 pts, subtract that out so we always forward a stream starting at zero (players like that)
packet.pts = packet.pts - vDiff;
packet.dts = packet.pts; // unless you have b frames, dts can equal pts. You probably don't have b frames.
await vmux.writeFrame({
packet: packet
});
}
}`
If you plan on passing audio also, opus requires a few steps depending on the source. You probably need a filter instead of just passing from decoder to encoder. Especially if changing sample rate from source.
(edit: not sure why the formatting here is messed up?)
from beamcoder.
Related Issues (20)
- Decoder hwaccel flag is too simplified
- Ubuntu 20.04 npm install fails, can't find PPA HOT 3
- Installation instructions HOT 3
- Permission to fork and create a LGPL variant of your project HOT 1
- Encoder message error catching HOT 1
- Releasing beamcoder-stream Nodejs Stream API HOT 1
- Why is the project abandoned? HOT 2
- Is there a way to get AAC data out of audio as ADTS?
- Is there a limit on number of demuxers? HOT 1
- Hardware Encoding Example Needed
- Please create encode_aac.js example to show how to create AAC frames from raw PCM data. HOT 3
- Will support arm64? HOT 1
- Memory leak on Windows 10/Ubuntu 20.04 LTS - x64
- Error splitting the input into NAL units. HOT 2
- How to use av_rescale_q_rnd/av_rescale_q in beamcoder ?
- Using pkg-config or similar for link dependencies
- Memory error: double free or corruption at format.cc HOT 1
- failed to install version v0.7.1 HOT 1
- A Typescript port ready for testing.
- Hardware accelerated filters are not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beamcoder.