mkchromecast icon indicating copy to clipboard operation
mkchromecast copied to clipboard

[question] Can I casting Linux Application Window and sound with mkchromecast ?

Open ghost opened this issue 6 years ago • 13 comments

I want to cast my favorite game from far away. Google Chrome and chromecast can cast image only (no sound). Can I cast image and sound at the same time using mkchromecast?

ghost avatar Jul 23 '18 16:07 ghost

With the --screencast you can achieve casting your whole screen to your chromecast but with some delay. It will cast sound as well, but I think it is only working with pulseaudio.

muammar avatar Jul 23 '18 16:07 muammar

@muammar Thank you very rapid response. By the way, can I one window screen such method(not whole screen)? I want to cast game window only. Thanks.

ghost avatar Jul 23 '18 16:07 ghost

I tested your information. But can't do that. The result is that casted TV was shown 'Default Media Receiver' 'Mkcchromecast v0.3.8.1' only. Doesn't show up image and sound. My environment is Linux Mint 19 (Ubuntu 18.04 LTS based) and installed at

$ dpkg -l | grep mkchromecast
ii  mkchromecast                              0.3.8.1-1                                   all          Cast your Linux audio or video to your Google Cast devices
ii  mkchromecast-alsa                         0.3.8.1-1                                   all          ALSA dependencies to cast with mkchromecast
ii  mkchromecast-gstreamer                    0.3.8.1-1                                   all          GStreamer dependencies to cast with mkchromecast
ii  mkchromecast-pulseaudio                   0.3.8.1-1                                   all          Pulseaudio dependencies to cast with mkchromecast

Is this bug?

ghost avatar Jul 23 '18 16:07 ghost

Can you paste here the command you use for casting your desktop?

muammar avatar Jul 31 '18 15:07 muammar

$ mkchromecast -s --screencast
Mkchromecast v0.3.8.1
Creating Pulseaudio Sink...
Open Pavucontrol and Select the Mkchromecast Sink.
Starting Local Streaming Server
[Done]
Selected backend: parec
Selected audio codec: mp3
Default bitrate used: 192k
Default sample rate used: 44100Hz.
PID of main process: 5229
PID of streaming process: 5238
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
 
List of Devices Available in Network:
-------------------------------------

Index   Types   Friendly Name 
=====   =====   ============= 
0 	Gcast 	実家リビング TV
1 	Gcast 	居室
 
Please, select the Index of the Google Cast device that you want to use:

Then, select 0.

Remember to open pavucontrol and select the mkchromecast sink.

Ctrl-C to kill the Application at any Time

192.168.x.x - - [01/Aug/2018 10:50:05] "GET /stream HTTP/1.1" 200 -

Doesn't work this.

ghost avatar Aug 01 '18 01:08 ghost

Can you try?

mkchromecast -s --screencast --video

muammar avatar Aug 01 '18 01:08 muammar

OK, I will test your replay after finish today's my job. Please wait. Thanks.

ghost avatar Aug 01 '18 02:08 ghost

@muammar I tried your command but doesn't work. This is full log and TV screenshot. Any idea ?

$ mkchromecast -s --screencast --video
Mkchromecast v0.3.8.1
Starting Video Cast Process...
PID of main process: 6891
PID of streaming process: 6895
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
 
List of Devices Available in Network:
-------------------------------------

Index   Types   Friendly Name 
=====   =====   ============= 
0 	Gcast 	居室
1 	Gcast 	実家リビング TV
 
Please, select the Index of the Google Cast device that you want to use:
1
 
Casting to: 実家リビング TV
 
 
Information about  実家リビング TV
 
DeviceStatus(friendly_name='実家リビング TV', model_name='Chromecast', manufacturer='Google Inc.', api_version=(1, 0), uuid=UUID('xxxxxxx-xxxx-xxxx-cedd-xxxxxxxxxxxxxxxx'), cast_type='cast')
 
Status of device  実家リビング TV
 
CastStatus(is_active_input=False, is_stand_by=True, volume_level=1.0, volume_muted=False, app_id='E8C28D3C', display_name='Backdrop', namespaces=['urn:x-cast:com.google.cast.debugoverlay', 'urn:x-cast:com.google.cast.cac', 'urn:x-cast:com.google.cast.sse'], session_id='xxxxxxx-xxxx-xxxx-cedd-xxxxxxxxxxxxxxxx', transport_id='xxxxxxx-xxxx-xxxx-cedd-xxxxxxxxxxxxxxxx', status_text='')
 
The IP of 実家リビング TV is: 192.168.11.139
Your local IP is: 192.168.14.2
 
The media type string used is: video/mp4
 
Cast media controller status
 
CastStatus(is_active_input=False, is_stand_by=True, volume_level=1.0, volume_muted=False, app_id='E8C28D3C', display_name='Backdrop', namespaces=['urn:x-cast:com.google.cast.debugoverlay', 'urn:x-cast:com.google.cast.cac', 'urn:x-cast:com.google.cast.sse'], session_id='xxxxxxx-xxxx-xxxx-cedd-xxxxxxxxxxxxxxxx', transport_id='xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx', status_text='')
 
Remember to open pavucontrol and select the mkchromecast sink.

Ctrl-C to kill the Application at any Time

mkchromecast_failed

ghost avatar Aug 01 '18 10:08 ghost

There’s no audio at all and pavucontrol doesn’t provide any option to switch it on. OS is Debian buster, let me know if you need any additional informations.

mkchromecast -s --screencast --video
Mkchromecast v0.3.8.1
Starting Video Cast Process...
PID of main process: 11037
 * Serving Flask app "mkchromecast.video" (lazy loading)
PID of streaming process: 11042
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
 
List of Devices Available in Network:
-------------------------------------

Index   Types   Friendly Name 
=====   =====   ============= 
0       Gcast   49PUS6561/12
 
Please, select the Index of the Google Cast device that you want to use:
0    
 
Casting to: 49PUS6561/12
 
 
Information about  49PUS6561/12
 
DeviceStatus(friendly_name='49PUS6561/12', model_name='edited-for-privacy', manufacturer='PHILIPS', uuid=UUID('edited-for-privacy'), cast_type='cast')
 
Status of device  49PUS6561/12
 
CastStatus(is_active_input=True, is_stand_by=False, volume_level=0.38333332538604736, volume_muted=False, app_id=None, display_name=None, namespaces=[], session_id=None, transport_id=None, status_text='')
 
The IP of 49PUS6561/12 is: edited-for-privacy
Your local IP is: edited-for-privacy
 
The media type string used is: video/mp4
 
Cast media controller status
 
CastStatus(is_active_input=True, is_stand_by=False, volume_level=0.38333332538604736, volume_muted=False, app_id=None, display_name=None, namespaces=[], session_id=None, transport_id=None, status_text='')
 
Remember to open pavucontrol and select the mkchromecast sink.

Ctrl-C to kill the Application at any Time

ffmpeg version 4.0.2-1+b1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8 (Debian 8.2.0-4)
  configuration: --prefix=/usr --extra-version=1+b1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
[x11grab @ 0x55a1635b5200] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0+0,0':
  Duration: N/A, start: 1536833169.065649, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 25 fps, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x55a1635c2840] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA3 BMI1
[libx264 @ 0x55a1635c2840] profile Constrained Baseline, level 4.0
[libx264 @ 0x55a1635c2840] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=6 sliced_threads=1 slices=6 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=60 keyint_min=6 scenecut=0 intra_refresh=0 rc_lookahead=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=10000 vbv_bufsize=20000 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=0
Output #0, mp4, to 'pipe:1':
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.18.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 10000000/0/0 buffer size: 20000000 vbv_delay: -1
edited-for-privacy - - [13/Sep/2018 12:06:09] "GET /stream HTTP/1.1" 200 -
Cleaning up /tmp/...q=12.0 size=   30634kB time=00:01:44.96 bitrate=2390.9kbits/s speed=   1x     
[Done]

github23leech avatar Sep 13 '18 10:09 github23leech

So when I use just mkchromecast it cast audio but when I do mkchromecast --video --screencast then I get only video :( In second case no sink is created.

gelldur avatar Apr 13 '19 16:04 gelldur

Hi Muammar! I try to use mkchromecast from KODI addon to cast videos to my TV. I have both an Chromecast Audio and a Chromecast Video. When mkchromecast starts it will just cast to the first Chromecast device which is always the Audio device in my case. If I use the s option, I will be asked to input the device I want to cast to - that works fine, but from the KODI addon it is not so easy to handle this extra input mkchromecast -s

If I could use an option like -s0, -s1 or something else to select the actual casting device it would be easy to control from the KODI addon.

Or is there a way to set the device number on the chromecast device?

Regards Hans

krogsbell avatar May 11 '19 09:05 krogsbell

Did anyone manage to find a way to cast both screen and audio at the same time to the same Chromecast device?

IPWright83 avatar May 31 '20 12:05 IPWright83

For me mkchromecast --video --screencast just works given that my screen resolution is 1920x1080 and not any lower (my old craptop has a 768p native resolution and requires scaling to get a 1080p desktop). Though due to my own audio device configuration the newly created mkchromecast sink is not selected automatically as the default sink and thus has to be manually selected. I could set the mkchromecast sink as default and get all of the audio there by default too.

drjaska avatar Feb 04 '24 23:02 drjaska