Comments (6)
I've added logType: 4
to config and after checking FFmpeg logs and the flows, I found that the problem was that fission was not working correctly.
To solve the problem, I added -threads 1
to fission's ffmpeg command. A quick workaround can be forking the project and adding '-threads', '1'
to the argv
array in the node_fission_session.js
file.
I'm not aware what causes this issue on my machines yet, because the hardwares were totally similar!
from node-media-server.
@Sina-KH I had the same problem on M1 Max and solved it by brew install ffmpeg
which installed v6 and then used:
ffmpeg: process.env.FFMPEG_PATH || '/opt/homebrew/Cellar/ffmpeg/6.0/bin/ffmpeg'
as the path.
Now fission folders and files are created, but they still do not fuse in the main index.m3u8.
Any ideas why or is this behaviour correct and I need to change the stream on the client side player?
const NodeMediaServer = require('node-media-server');
const config = {
logType: 4,
rtmp: {
port: 1935,
chunk_size: 100,
gop_cache: false,
ping: 30,
ping_timeout: 60,
},
http: {
port: 8000,
mediaroot: __dirname+'/media',
webroot: __dirname+'/www',
allow_origin: '*',
api: true
},
fission: {
ffmpeg: process.env.FFMPEG_PATH || '/opt/homebrew/Cellar/ffmpeg/6.0/bin/ffmpeg',
tasks: [
{
rule: "live/*",
model: [
{
ab: "128k",
vb: "3500k",
vs: "1920x1080",
vf: "30",
},
{
ab: "128k",
vb: "1500k",
vs: "1280x720",
vf: "30",
}
]
},
]
},
trans: {
ffmpeg: process.env.FFMPEG_PATH || '/opt/homebrew/Cellar/ffmpeg/6.0/bin/ffmpeg',
tasks: [
{
app: 'live',
vc: "copy",
ac: "copy",
hls: true,
hlsFlags: '[hls_time=1:hls_list_size=3:hls_flags=delete_segments]',
mp4: true,
mp4Flags: '[movflags=frag_keyframe+empty_moov]',
},
]
},
};
const nms = new NodeMediaServer(config);
nms.run();
Also I noticed that the main incoming stream does not have a resolution. Maybe that plays a role:
from node-media-server.
@Sina-KH I had the same problem on M1 Max and solved it by
brew install ffmpeg
which installed v6 and then used:ffmpeg: process.env.FFMPEG_PATH || '/opt/homebrew/Cellar/ffmpeg/6.0/bin/ffmpeg'
as the path.Now fission folders and files are created, but they still do not fuse in the main index.m3u8.
Any ideas why or is this behaviour correct and I need to change the stream on the client side player?
const NodeMediaServer = require('node-media-server'); const config = { logType: 4, rtmp: { port: 1935, chunk_size: 100, gop_cache: false, ping: 30, ping_timeout: 60, }, http: { port: 8000, mediaroot: __dirname+'/media', webroot: __dirname+'/www', allow_origin: '*', api: true }, fission: { ffmpeg: process.env.FFMPEG_PATH || '/opt/homebrew/Cellar/ffmpeg/6.0/bin/ffmpeg', tasks: [ { rule: "live/*", model: [ { ab: "128k", vb: "3500k", vs: "1920x1080", vf: "30", }, { ab: "128k", vb: "1500k", vs: "1280x720", vf: "30", } ] }, ] }, trans: { ffmpeg: process.env.FFMPEG_PATH || '/opt/homebrew/Cellar/ffmpeg/6.0/bin/ffmpeg', tasks: [ { app: 'live', vc: "copy", ac: "copy", hls: true, hlsFlags: '[hls_time=1:hls_list_size=3:hls_flags=delete_segments]', mp4: true, mp4Flags: '[movflags=frag_keyframe+empty_moov]', }, ] }, }; const nms = new NodeMediaServer(config); nms.run();Also I noticed that the main incoming stream does not have a resolution. Maybe that plays a role:
Did you try hlsKeep: true
to prevent hls file delete after end of the stream?
And did you change node_fission_session.js
to have -threads 4
(4 is number of required threads) as I've mentioned?
from node-media-server.
@Sina-KH, yes but maybe I'm missing something.
My solution was to create a custom master.m3u8 and link the streams through it:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=1500000,RESOLUTION=1280x720
stream_720/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=3500000,RESOLUTION=1920x1080
stream/index.m3u8
Did you manage to fuse the fission's m3u8 on your main stream?
if so can you please paste here the output as to know what to expect?
Also do you have size
on your main stream or is it 0x0?
I have a feeling it has to do with the ffmpeg version...
from node-media-server.
Exactly, I've created the primary .m3u8 file just like you did.
In the node_fission_session.js
file, change line 23 to:
let outPath = ['-threads', '4', '-f', 'flv', 'rtmp://127.0.0.1:' + this.conf.rtmpPort + '/' + this.conf.streamApp + '/' + this.conf.streamName + '_' + m.vs.split('x')[1]];
And 4
is the number of threads. (maybe you can try adding this flag to line 19 and it work, also.)
I have no idea about your problem (size issue you mentioned) but with these changes my stream is working fine.
It also worth mentioning that the main hls output did not respect hls_time I passed to its flags, so I had to use fission and recreate my original resolution hls, also.
from node-media-server.
hi, I have tried on react-native-nodemediaclient version 0.3.3 here
<NodePublisher ref={np} style={{flex: 1}} url={url} audioParam={{ codecid: NodePublisher.NMC_CODEC_ID_AAC, profile: NodePublisher.NMC_PROFILE_AUTO, samplerate: 48000, channels: 1, bitrate: 64 * 1000, }} videoParam={{ codecid: NodePublisher.NMC_CODEC_ID_H264, profile: NodePublisher.NMC_PROFILE_AUTO, width: 720, height: 1280, fps: 30, bitrate: 2000 * 1000, }} frontCamera={frontCamera} HWAccelEnable={true} denoiseEnable={true} torchEnable={torchEnable} keyFrameInterval={2} volume={mute ? 0.0 : 1.0} videoOrientation={ NodePublisher.VIDEO_ORIENTATION_PORTRAIT }/>
but when I look at the log in the nodemediaserver "handle video" section, I see the video dimensions are 0x0 so when I play the video in VLC the result is only sound.
[rtmp publish] Handle video. id=CRO7UOB1 streamPath=/live/genta-F2WKcWWJ frame_type=1 codec_id=7 codec_name=H264 0x0
Meanwhile, if I comment HWAccelEnable it will be read.
[rtmp publish] Handle video. id=UJUN7E6K streamPath=/live/genta-F2WKcWWJ frame_type=1 codec_id=7 codec_name=H264 720x1280
but there is a new problem, I can't play it on Android with hls extenston with error message:
{"errorException": "com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(0, null, null, video/avc, avc1.7A001F, -1, null, [720, 1280, -1.0], [-1, -1]), format_supported=NO_EXCEEDS_CAPABILITIES", "errorString": "ExoPlaybackException type : 1"}
what do you think is wrong?
from node-media-server.
Related Issues (20)
- Can I disconnect streamer's rtmp connection? HOT 1
- Node media server ignores hls_time=1:hls_list_size=1
- How to stream VOD playback?
- How to stream mp4 files? HOT 1
- Connection to tcp://localhost:19351?tcp_nodelay=0 failed: Error number -138 occurred
- Clients Getting Video Stuttering
- Add ability to publish stream from client side HOT 1
- Hls.js player doesn't load the stream if the first segment of hls doesn't exist HOT 2
- Stream Disconnections when Sending Static Images from ATEM Mini Pro to NMS
- rtmp library metadata support for AV1 encoded livestreaming
- flv file is not present in my live folder
- Integrating Node-Media-Server with AWS S3 for Media Streaming
- Leave session opened on RTMP encode (OBS) stop/restart streaming
- React Native Node media client disappeared HOT 3
- Is there TLS support for Node Media Server?
- Dynamic pull with Ffmpeg custom command?
- Acked sequence number wrong(?) after wrap around HOT 1
- Node Media Server Rename Session Folders
- rtmp推流可以设置密码吗? HOT 2
- How to insert current time on live video?
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 node-media-server.