-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[Work in progress] Adding an option --serve tcp:localhost:port #1159
Comments
Is it possible to send frames already decoded by FFmpeg instead of forwarding packet? If yes, any idea in which function I should take it and write it to a socket? |
(sorry, I don't have much time right now to review)
That's a bad idea, the decoded frames are way bigger than the encoded ones. You want to transmit the encoded stream, and decode on the client. ¹ For example, in YUV 4:2:0 at 8 bit/color, each pixel takes 16 bits. In 1920×1080, that's 4Mb/frame. At 60fps, 237Mb/s. |
Don't be sorry! You're very helpful with everyone so thank you 😉.
Ok haha, I asked because I'm having trouble decoding H264 stream on my client because I'm using C# with Unity 3D and, by this fact, it's more complicated to use FFmpeg library to decode since it's less documented and have some compatibility issues that's requiring additional development. |
Note that if you just want to test your implementation of the vlc --demux h264 tcp://localhost:1234 (the latency will be higher because VLC bufferizes, but it should work) The behavior of the # listen on localhost:1234 and stream the ouput of screenrecord
adb exec-out screenrecord --output-format h264 - | nc -l -p 1234 |
@Darkroll76 |
@Darkroll76 I am also working on this feature... https://github.com/dedosmedia/scrcpy/tree/h264 @rom1v
scrcpy continues its process and launch SDL_Window, where I can see my phone screen, however, VLC does not play anything. When I do the same, but using Putty (raw mode, port 27184). I can see that I receive a lot of garbage, much more when I handle my screen's phone. Maybe we are not sending the right thing. Excuse but I don't understand anything about AVFrame, AVPacket, frame, pts, header... etc
Maybe we are not sending the right thing... I know you are busy with other matters, however, if you have a few free minutes, please give us a hand to get this working. Thanks in advanced |
[UPDATE] Hi, I almost did it. @dedosmedia I changed to I gave the possibility the display the screen (or not) independently from @rom1v What about allowing recording and serve at the same time? TODO:
IDEAS:
|
Good catch :)
Yes, (and it should be done from another thread, not to block the stream on blocking calls).
Nope, UDP does not guarantee packet ordering and does not retransmit lost packets, so the stream will be corrupted as soon as one of these events occur. |
[UPDATE]
Ok, I was wondering if it should be allowed or not.
So, we can remove tcp as parameter: |
For now, we can. In theory, we could also serve over other protocols ( |
Very interesting idea! I simply viewed the code, there are several coding style needs to be refined. For example,
After feature completed, I suggest to fix coding style before sending PR. Overall, I like this idea, we can build some application after supporting this feature. And it can be a temporary workaround before |
It's a great feature for streaming to OBS without opening a scrcpy window too 😉 |
@npes87184 Are you talking about the code shown in my first post? Because it was just for testing. |
It works now! You both Rock guys! |
👍
Arf, it does not work: OBS supports opening a stream from VLC, but not adding extra parameters ( |
hi, thanks a lot for your work. can I ask for a feature package this (tcp) h264 stream into a v4l-like video capture device which can then be used by any application like skype, zoom, obs, etc. |
@solnyshok Yes, I thought there was already a feature request for that, but I didn't find it. Could you create one please? |
I'm really looking forward to this feature. Can't wait to use it on my website :D |
Hello I am trying to implement a scrcpy in c# to extend some functionality in a familiar environment. But, there are some problems with video decoding. Have you found a good solution to decode and show raw h264 in c#? |
I have the same problem as you, did you resolve this? I mean to decode and show raw h264 in c#. |
No. I am still using ffmpeg. But it sometimes crashes and so I have to reset the connection. All the wrapper libraries I've tried have similar problems and none have proven to be stable enough. Reducing the frame rate slightly improves the situation. |
Hello, Would this work help for #1939 (comment) ? Regards, |
Hi, |
https://github.com/qaisbayabani/SCRCPY-C-Sharp-Client is 100% stable now and also without adb server and client updated on git |
UPDATE now its Stable |
yup |
Hi everyone,
Following this post: #1073 and suggested by @rom1v, I started to work on an option
--serve
. This option would allow forwarding the video stream to any clients connected. It could be a C# Unity App, Java App or C# UWP App or whatever.The command would be
--serve tcp:localhost:1234
It could be a great solution for people like me, who wants to display the video stream inside a desktop application without redeveloping and rebuilding the scrcpy client in the desired language.
I create this post to give some updates and request some help in C development.
Following these indications :
So, we create another socket (for testing, we're using localhost and port 27015)
In
stream.c -> run_stream(void *data)
We 're not sure that we are sending the right thing yet but this is our first step.
Everyone who wants to help is welcomed 😃 !
Thanks,
The text was updated successfully, but these errors were encountered: