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

Only MseDecoder can work, other decoders display black screen. #25

Closed
pigass0512 opened this issue Jul 13, 2020 · 12 comments
Closed

Only MseDecoder can work, other decoders display black screen. #25

pigass0512 opened this issue Jul 13, 2020 · 12 comments
Labels
help wanted Extra attention is needed

Comments

@pigass0512
Copy link

As title, only native decoder can work in my environment, the other three decoder display black screen after I launch the web page.
Can someone help to check this out?

Chrome version: 83.0.4103.116
Desktop OS: Windows 10
NPM version: 6.14.5
NODE version: 8.17.0

@drauggres drauggres added the help wanted Extra attention is needed label Jul 14, 2020
@drauggres
Copy link
Collaborator

To be clear, all three other decoders work for me on mac/linux/windows on chrome/firefox and safari. I don't know where to look at.
Any help or additional info (maybe there are logs in the console in dev-tools) appreciated.

Screenshot. Win10/Chrome 83

ws-scrcpy

@LeeGenD
Copy link

LeeGenD commented Sep 16, 2020

This situation may be caused by a special device(Android mobile phone), because the three decoders work for my first device, but not work for another.
Another reason is because broadway.js only support low quality video streaming.

@drauggres
Copy link
Collaborator

drauggres commented Sep 20, 2020

@LeeGenD @pigass0512
Can you share the first two video frames that come over the websocket?
They have 0000 0001 67 and 0000 0001 65 bytes at the beginning.

Screenshot.

websoket-messages-base64

Upd: base64 is prefered.

@drauggres
Copy link
Collaborator

Also please try to change this line to const CODEC_OPTIONS = 'profile=1,level=1';:

const CODEC_OPTIONS = '-';

You will need kill app_process, this parameter is passed as an argument to the scrcpy-server.

@drauggres drauggres changed the title Only native decoder can work, other decoders display black screen. Only MseDecoder can work, other decoders display black screen. Sep 22, 2020
@pigass0512
Copy link
Author

pigass0512 commented Sep 23, 2020

@LeeGenD @pigass0512
Can you share the first two video frames that come over the websocket?
They have 0000 0001 67 and 0000 0001 65 bytes at the beginning.

Screenshot.
Upd: base64 is prefered.

Hi master,

But I can not using any decoders after I build the service with v0.4.1.....OMG!!
I had reboot my device and using the same wifi network, but still cannot launch the screenshot....lol

@drauggres
Copy link
Collaborator

But I can not using any decoders after I build the service with v0.4.1.....OMG!!
I had reboot my device and using the same wifi network, but still cannot launch the screenshot....lol

After reboot do you open "device list" page first or directly /#!action=stream&? Server is installed after devices detection, which happens only when "device list" page requested.

@pigass0512
Copy link
Author

But I can not using any decoders after I build the service with v0.4.1.....OMG!!
I had reboot my device and using the same wifi network, but still cannot launch the screenshot....lol

After reboot do you open "device list" page first or directly /#!action=stream&? Server is installed after devices detection, which happens only when "device list" page requested.

Hi master,

My steps as below :

  1. Reboot my mobile device.
  2. Git clone the project with v0.4.1
  3. npm install and start the service.
  4. Go to Device list web page.
  5. Click one of decoder in list.

@drauggres
Copy link
Collaborator

drauggres commented Dec 29, 2020

Also please try to change this line to const CODEC_OPTIONS = 'profile=1,level=1';:

const CODEC_OPTIONS = '-';

You will need kill app_process, this parameter is passed as an argument to the scrcpy-server.

Tried on OnePlus 6 (Android 10): with profile=1,level=1 Broaway and TinyH264 work just fine.
Will add fix to the next release.

UPD: but it breaks encoder on some devices with android 6...

@MartinRGB
Copy link

Also please try to change this line to const CODEC_OPTIONS = 'profile=1,level=1';:

const CODEC_OPTIONS = '-';

You will need kill app_process, this parameter is passed as an argument to the scrcpy-server.

Tried on OnePlus 6 (Android 10): with profile=1,level=1 Broaway and TinyH264 work just fine.
Will add fix to the next release.

UPD: but it breaks encoder on some devices with android 6...

works,better write in README.MD

@drauggres
Copy link
Collaborator

Using these options by default is not an options.
I'm thinking about using profile=1,level=1 automatically on Android 10+ and keeping - for others, but I haven't decided yet.
Also I want to add possibility to change "codec options" (and new encoder parameter) at runtime same way as video settings.

@drauggres
Copy link
Collaborator

I have implemented a configuration dialog in the develop branch.
Now, before opening the stream, you can configure video settings, including codec options and encoder.

Changing encoder look like a simpler solution than setting codec options.

If anyone can test it, please let me know the results.

@drauggres
Copy link
Collaborator

To summarize:

  1. Broadway.js and Tiny H264 are capable to decode only video encoded with Baseline profile
  2. To change profile you can:
  • specify codec option (not necessary exactly profile=1,level=1, but it seems to work in some cases, for more information see --codec-options option in scrcpy)
  • select different encoder (hoping it has Baseline as default profile)

Otherwise you can use MSE based player, at the momen we use here xevokk/h264-converter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants