Programming/node.js2018. 9. 12. 10:29

흐음..

일단은 되는데 안된다(응?)


app.js

Stream = require('node-rtsp-stream');

stream = new Stream({

    name: 'name',

    streamUrl: 'rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov',

    wsPort: 9999

}); 


view/index.pug

  script(src="javascripts/jsmpeg.min.js")

  div(class="jsmpeg" data-url="video.ts" disableGl="true")

  div(class="jsmpeg" data-url="ws://10.0.100.100:9999" disableGl="true") 


node_modules/node-rtsp-stream/lib/mpeg1muxer.js

//    this.stream = child_process.spawn("ffmpeg", ["-rtsp_transport", "tcp", "-i", this.url, '-f', 'mpeg1video', '-b:v', '800k', '-r', '30', '-'], {

    this.stream = child_process.spawn("ffmpeg", ["-rtsp_transport", "tcp", "-i", this.url, '-f', 'mpegts', '-codec:v', 'mpeg1video', '-b:v', '800k', '-r', '30', '-'], {


public

wget https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_stereo.avi

ffmpeg -i big_buck_bunny_480p_stereo.avi  -f mpegts -codec:v mpeg1video video.ts



disableGl은 적용이 안되는 것으로 보이고

변환한 ts와 외부 스트리밍은 문제없이 재생된다.




+

일단은 제어를 위해서 javascript 버전으로 구현

<script src="javascripts/jsmpeg.min.js"></script>

<canvas id="video-canvas"></canvas>

<script type="text/javascript">

var canvas = document.getElementById('video-canvas');

var url = 'video.ts';

var player = new JSMpeg.Player(url, {canvas: canvas});

player.play();


setInterval(function() {console.log(player.currentTime);}, 1000);

</script><button onclick="player.pause()"></button><button onclick="player.play()"></button>


[링크 : https://github.com/phoboslab/jsmpeg/blob/master/view-stream.html]


---

영상이 블럭이 생기며 신명나게 깨진다 -_ㅠ




fork된 node-rtsp-stream-es6 참조

[링크 : https://github.com/Wifsimster/node-rtsp-stream-es6/commit/1a52492fc9bf216e8fe646e4f13148694263a282]


ffmpeg -i rtsp://192.168.168.22 -f mpegts -codec:v mpeg1video -bf 0 -codec:a mp2 -r 30 http:// localhost:8081/1234/640/480 / ” 


[링크 : https://github.com/phoboslab/jsmpeg/issues/149]



'Programming > node.js' 카테고리의 다른 글

node.js 콘솔 입력 받기  (0) 2018.09.12
node.js JSON.parse()  (0) 2018.09.12
node.js 글로벌 모듈 목록보기  (0) 2018.09.11
node-rtsp-stream 윈도우에서 설치하기는 실패?  (0) 2018.09.11
node.js HTTP 요청하기  (0) 2018.09.10
Posted by 구차니