Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirroring laptop screen on samsung smart tv #47

Closed
nneverlander opened this issue Sep 1, 2015 · 17 comments
Closed

Mirroring laptop screen on samsung smart tv #47

nneverlander opened this issue Sep 1, 2015 · 17 comments

Comments

@nneverlander
Copy link

I have a Samsung smart tv which is miracast enabled. Now how can I cast my ubuntu screen to the tv? In other words, how can I use my laptop as source and the tv as sink?

@nneverlander
Copy link
Author

So my question is after pairing, can't I mirror my laptop screen on tv since there is no implementation?

@albfan
Copy link
Owner

albfan commented Sep 1, 2015

There is a miracle-wifictl to expose your laptop as a source.

$ sudo miracle-wifictl
[miracle-wifictl] select <your peerr number>
[miracle-wifictl] connect <destination mac> prov pin

But after pairing, there's no implementation of any stream protocol

@albfan
Copy link
Owner

albfan commented Sep 2, 2015

After pairing, something should start a stream from source to sink. It is just not implemented.

Here is a good description of what's happening underneat

http://sysmagazine.com/posts/207456/

This is too a good diagram of what is happening on miracle-wifictl

https://raw.githubusercontent.com/kensuke/How-to-Miracast-on-AOSP/master/docs/images/design_RTSP.png

Just grep the code for "wfd_trigger_method", "7236" (default port), "SET PARAMETER" to figure out what you need to do to source your screen to a miracast sink.

@a-posadas
Copy link

Can you elaborate here. I can also connect but if I run gst-launch with a pipeline that is supposed to work (because I tried it with wds) it never displays.

Do I need or need to write an rtsp server or what is it that we are missing?

Thanks

@albfan
Copy link
Owner

albfan commented Mar 3, 2016

Let me make a review of this all and see in detail what is need to be done.

@a-posadas
Copy link

I appreciate the response. Thank you.

@albfan
Copy link
Owner

albfan commented Mar 28, 2016

Here is a Q&D (quick and dirty) for use laptop as source:

Start miracle-wifid as usual

$ sudo miracle-wifid --log-level trace

Start miracle-wifictl

$ sudo miracle-wifictl --log-level trace
[miraclectl] # list
  LINK INTERFACE                FRIENDLY-NAME                 
     3 wlp3s0                   archlinux-alberto             
  LINK PEER-ID                  FRIENDLY-NAME                  CONNECTED 
 0 peers and 1 links listed.
[miraclectl] # select 3
link 3 selected

Now do something to make your device visible (like start screen mirroring)

[ADD] Peer: f2:27:65:35:b6:8f@3
[PROV] Peer: ff:ff:ff:ff:ff:ff@3 Type: pbc PIN: 
[miraclectl] # list
  LINK INTERFACE                FRIENDLY-NAME                 
     3 wlp3s0                   archlinux-alberto             
  LINK PEER-ID                  FRIENDLY-NAME                  CONNECTED 
     3 ff:ff:ff:ff:ff:ff@3           Alberto Fanjul Alonso            no        
 1 peers and 1 links listed.
[miraclectl] # connect ff:ff:ff:ff:ff:ff@3
[CONNECT] Peer: ff:ff:ff:ff:ff:ff@3
[miraclectl] # list
  LINK INTERFACE                FRIENDLY-NAME                 
     3 wlp3s0                   archlinux-alberto             
  LINK PEER-ID                  FRIENDLY-NAME                  CONNECTED 
     3 ff:ff:ff:ff:ff:ff@3           Alberto Fanjul Alonso            yes        
 1 peers and 1 links listed.

Search on miracle-wifid output for a message like this

TRACE: wpa: raw message: <3>P2P-GROUP-STARTED p2p-wlp3s0-3 client ssid="DIRECT-ZP-Alberto Fanjul Alonso" freq=2462 psk=5d3ce6a19876398db2d9b7566cc1d8e3a87c36b449ff3fd601f95d60718cdd4e go_dev_addr=ff:ff:ff:ff5:ff:ff ip_addr=192.168.49.200 ip_mask=255.255.255.0 go_ip_addr=192.168.49.1

At this point you have your devices paired show they can see each other

Start a stream on laptop (using vlc for example)

$ cvlc screen:// :screen-fps=25 :screen-caching=100 --sout '#transcode{vcodec=MJPG,vb=0,width=1022,height=575,acodec=none}:http{mux=ogg,dst=:8554/myscreen}'

On the other device use some viewer to reproduce that:( I've used vlc for android)

that stream can be viewed opening url: http://192.168.49.200:8554/myscreen

Develops needed:

  1. autocomplete peer-id on miracle-wifictl
  2. miracle-sinkctl need a command to launch automatically that external command (miracle-sinkctl does the same with gstreamer)
  3. provide a gstreamer command to stream screen (See examples here https://coderwall.com/p/_inesq/gstreamer-commands-for-desktop-streaming-to-raspberry-pi)
  4. Develop an android app based on vlc for android to make device visible, pair with laptop and receive config from miracle-sinkctl about url to open

@a-posadas
Copy link

Thanks, I'll try this. Although I'm still confused, my understanding is that vlc is going to handle the rtp and rtsp and this might not be the same as say a standard off the shelf miracast adapter for the TV.

@albfan
Copy link
Owner

albfan commented Mar 31, 2016

See I say Q&D.

Miracast is just a protocol, miraclecast uses gstreamer to read the streaming from source. As pointed out, implementing those 4 points will make miraclecast handle internally all the process, but again using something to create the streaming.

On the other device (now the sink) what process is waiting for that connection? It must be an process told to wait for a streaming somewhere (ip and port). On Q&D process is totally manual (as expected), but is just a step away to be miracast compatible.

@a-posadas
Copy link

Once again, thank you for all your help. This is a great tool as is.

On the other device (now the sink) what process is waiting for that connection?

Since it is just an adapter, I cannot log into it and see the process list. I don't have the device with me right now but I did run an nmap after pairing and did see two ports open. One was 80 for http and the other iirc was 7236. At this point I only get confused because simply running a gstreamer pipeline to the ip and port does not work with this adapter.

@albfan
Copy link
Owner

albfan commented Apr 2, 2016

You need to check rtsp messages to see what port and formats the samsung tv supports. --log-level trace on miracle-wifictl should show them.

@albfan
Copy link
Owner

albfan commented Apr 19, 2016

on logs from miracle-wifictl you must see rstp messages from devices. There you can find if both devices are correctly configured. All that messages should tell your tv what to stream (url and port) and that's what you need to stream from laptop to allow tv to show it.

Ask to reopen if you keep working on this

@albfan albfan closed this as completed Apr 19, 2016
@sachin701
Copy link

how to connect tv into laptop in ubuntu 16.04 for miracast
plz tell me code....

@albfan
Copy link
Owner

albfan commented Oct 2, 2016

@sachin701 see #4

@arpitjindal97
Copy link

Has anyone successfully mirrored laptop screen to samsung smart tv?

@mabusdogma
Copy link

I'm still looking for the same thing: I have a Samsung Smart TV and Ubuntu installed in a phone (OneplusOne, via Linux deploy), and since I don't have an option to use MTP/HDMI on the OnePlus, to do it wirelessly is the only option... I can do it easily trough android, but not on Ubuntu... any ideas?

@albfan
Copy link
Owner

albfan commented Apr 4, 2018

@mabusdogma this is a close issue, continue on #4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants