xat / castnow

commandline chromecast player

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

streaming my desktop

storchi opened this issue · comments

i thought streaming my entire desktop would be a nice feature.
i played around with ffmpeg to capture x11:
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -threads 8 -i :0.0+10,20 Videos/output.mp4
this content is streamable after capture is finished:
debug:
cs@TP-T420s:~/src$ DEBUG=castnow* castnow /home/cs/Videos/output.mp4
castnow volume step: 0.05 +0ms
castnow launching... +3ms
castnow:stdin [ { path: '/home/cs/Videos/output.mp4' } ] +3ms
castnow:localfile started webserver on address 192.168.1.217 using port 4100 +10ms
castnow player status: loading plugins +1ms
castnow player status: scanning +1ms
castnow player status: connecting +434ms
castnow player status: launching +127ms
castnow player status: loading +2s
castnow:localfile incoming request serving /home/cs/Videos/output.mp4 +1s
castnow:localfile incoming request serving /home/cs/Videos/output.mp4 +870ms
castnow:localfile incoming request serving /home/cs/Videos/output.mp4 +173ms
castnow player status: ready +2s
castnow player status: buffering +35ms
castnow player status: playing +1s

streaming while capturing does not work:
cs@TP-T420s:~/src$ DEBUG=castnow* castnow /home/cs/Videos/output.mp4
castnow volume step: 0.05 +0ms
castnow launching... +3ms
castnow:stdin [ { path: '/home/cs/Videos/output.mp4' } ] +4ms
castnow:localfile started webserver on address 192.168.1.217 using port 4100 +11ms
castnow player status: loading plugins +1ms
castnow player status: scanning +1ms
castnow player status: connecting +255ms
castnow player status: launching +101ms
castnow player status: loading +2s
castnow:localfile incoming request serving /home/cs/Videos/output.mp4 +948ms
castnow player error: Error: Load failed at /usr/lib/node_modules/castnow/node_modules/chromecast-player/api.js:104:19 at fn.onmessage (/usr/lib/node_modules/castnow/node_modules/castv2-client/lib/controllers/request-response.js:27:7) at emitTwo (events.js:111:20) at fn.emit (events.js:194:7) at Channel.onmessage (/usr/lib/node_modules/castnow/node_modules/castv2-client/lib/controllers/controller.js:16:10) at emitTwo (events.js:106:13) at Channel.emit (events.js:194:7) at Client.onmessage (/usr/lib/node_modules/castnow/node_modules/castv2-client/node_modules/castv2/lib/channel.js:23:10) at emitMany (events.js:132:20) at Client.emit (events.js:204:7) +1s
Error: Load failed

what do you think?

regards
cstorch

I created simple screen recording GStreamer wrapper called gst-rec. In addition to recording desktop it can be used with castnow to achieve desktop streaming on Linux.

gst-rec -o - | castnow --quiet -

And if you want sound, first determinate your pulseaudio output sink name with:

pacmd list-sources | grep -e "name:"

Then run it as follows (replace audio device name):

gst-rec --audio device=alsa_output.pci-0000_00_01.1.hdmi-stereo.monitor,encoder=lamemp3enc -o - | castnow --quiet -

If your desktop monitor resolution exceeds 1920x1080 you can enable video scaling:

gst-rec --video width=1920,height=1080,scaling=true -o - | castnow --quiet -