-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Codec options #1325
Codec options #1325
Conversation
@rom1v ping :) |
@tzah4748 Don't worry, I haven't forgotten, it the next task in my scrcpy TODO list :) I just took a look, globally, it seems ok 👍 When I have some time, I will look in detail and test. Sorry for the delay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worked a bit on it tonight.
I did several changes (codec_options
):
- rebased on current
dev
- split the parsing from the Media format configuration (so that
ScreenEncoder
do not deal with the specific format of--codec-option
) - changed the format from
key=value[:type]
tokey[:type]=value
(maybe it's just a personal preference, but it seems more logical to me) - improved parsing of codec options so that strings could contain anything, including commas (
--codec-options 'some_key=a\,b
for example, to seta,b
tosome_key
), for completeness - added unit test
This feature works, but I initially assumed that setting only the profile without the level would work: #1226 (comment)
I should have tested: it does not.
# works
scrcpy --codec-options profile=1,level=4096
# does not work
scrcpy --codec-options profile=1
I have just read #1226 discussion again, I think I should have read your answers more carefully. You were right: an option --codec-profile
is probably better.
So I think I will keep this branch (codec_options
) unmerged for now, and I will reconsider your PR #1226 instead. I'm sorry and confused, I made you waste time 😕
I will try to find some time for that soon. For now, I need rest :)
Good night.
for (String pair : codecOptions.split(",")) { | ||
String[] option = pair.split("="); | ||
String key = option[0]; | ||
if(format.containsKey(key)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, contrary to what I said in a previous PR, this does not do what I expected (in fact it just test whether we already set the key, so in practice this is always false).
String value = valueAndType[0]; | ||
String type = valueAndType.length < 2 ? "" : valueAndType[1].toLowerCase(); | ||
if (type.contains("str")) { | ||
format.setString(key, value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could not pass a String containing a ,
.
Add a command-line parameter to pass custom options to the device encoder (as a comma-separated list of "key[:type]=value"). The list of possible codec options is available in the Android documentation: <https://d.android.com/reference/android/media/MediaFormat> PR #1325 <#1325> Refs #1226 <#1226> Co-authored-by: Romain Vimont <rom@rom1v.com>
Merged into Thank you 👍 |
Can you explain what this function does? |
@kass507 To increase the quality, just increase the bitrate:
(This feature just passes raw parameters to MediaFormat, for advanced usage.) |
This function only works when using low qualities. I have placed above 15 and no more than 12 passes. |
somehow the intel-encoder crashes all the time on my panasonic FZ-A2 and i use the google encoder for that. the intel one is way better. How can i install the broadway encoder to my panasonic tablet to test it? |
You can't "install" an encoder, it typically just implements an API to give instructions to an hardware component on your device. |
Introduced options arguments for the Android MediaCodec library.
The original need:
There are some decoders like Broadway that can accept only H.264 Baseline profile streams.
This profile is considered the most generic and is available on most Android devices.
To allow selecting a profile new option has been added to client and server.