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

vlc can not run #1

Open
tz527129804 opened this issue Jun 10, 2020 · 17 comments
Open

vlc can not run #1

tz527129804 opened this issue Jun 10, 2020 · 17 comments

Comments

@tz527129804
Copy link

tz527129804 commented Jun 10, 2020

I’m using huawei‘s EMUI 10.1 and Notification bar shows forwarding (Microphone permission has been given).But nothing happened after “playing audio” has occurred.

I have changed the vlc to the correct path on my win10 without changing other configs.
Mybe I need to install VLC to the default path ?

@tz527129804 tz527129804 changed the title vlc cannot run vlc can not run Jun 10, 2020
@slimsymphony
Copy link

yep, install vlc on your pc then work like charm~

@rom1v
Copy link
Owner

rom1v commented Jun 10, 2020

Mybe I need to install VLC to the default path ?

Yes, or you can set an environment variable containing the full path to vlc.exe:
https://github.com/rom1v/sndcpy/blob/master/README.md#environment-variables

Default value is C:\Program Files\VideoLAN\VLC\vlc.exe:

if not defined VLC set VLC="C:\Program Files\VideoLAN\VLC\vlc.exe"

@tz527129804
Copy link
Author

tz527129804 commented Jun 10, 2020

Mybe I need to install VLC to the default path ?

Yes, or you can set an environment variable containing the full path to vlc.exe:
https://github.com/rom1v/sndcpy/blob/master/README.md#environment-variables

Default value is C:\Program Files\VideoLAN\VLC\vlc.exe:

if not defined VLC set VLC="C:\Program Files\VideoLAN\VLC\vlc.exe"

I try again,reinstall VLC to default path(C:\Program Files\VideoLAN\VLC\vlc.exe).
then I run the sndcpy.bat
Here is the display content:

Waiting for device...
Performing Streamed Install
Success
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rom1v.sndcpy/.MainActivity }
Press Enter once audio capture is authorized on the device to start playing...
Playing audio...

I still can’t see VLC playing anything 😭
To be precise, vlc even did not appear!

@rom1v
Copy link
Owner

rom1v commented Jun 10, 2020

To be precise, vlc even did not appear!

That's expected, it is started with -Idummy.

%VLC% -Idummy --demux rawaud --network-caching=50 --play-and-exit tcp://localhost:%SNDCPY_PORT%

But the audio should still be played.

@tz527129804
Copy link
Author

To be precise, vlc even did not appear!

That's expected, it is started with -Idummy. But the audio should still be played.

%VLC% -Idummy --demux rawaud --network-caching=50 --play-and-exit tcp://localhost:%SNDCPY_PORT%

I can see TCP link established,but no audio played,maybe huawei‘s EMUI changes some system settings.
(Ps : miracast protocol can transfer audio with low delay.I have used it on win10 as an alternative)
Thank you for your answer !

@rom1v
Copy link
Owner

rom1v commented Jun 10, 2020

I can see TCP link established,but no audio played

What application do you test? Some apps do not allow to capture their audio (this unfortunately includes Firefox and Chrome).

For example, try youtube or VLC for Android.

@tz527129804
Copy link
Author

Unfortunately,still no sound

I can see TCP link established,but no audio played

What application do you test? Some apps do not allow to capture their audio (this unfortunately includes Firefox and Chrome).

For example, try youtube or VLC for Android.

Unfortunately,still no sound. l will try another phone in the future.

@rom1v
Copy link
Owner

rom1v commented Jun 10, 2020

Try to remove -Idummy for there:

%VLC% -Idummy --demux rawaud --network-caching=50 --play-and-exit tcp://localhost:%SNDCPY_PORT%

As a consequence, it will open the VLC gui. Maybe it will give a hint about the problem.
For example, press Ctrl+m in the VLC window to open the messages dialog.

@tz527129804
Copy link
Author

Try to remove -Idummy for there:

%VLC% -Idummy --demux rawaud --network-caching=50 --play-and-exit tcp://localhost:%SNDCPY_PORT%

As a consequence, it will open the VLC gui. Maybe it will give a hint about the problem.
For example, press Ctrl+m in the VLC window to open the messages dialog.

I can see VLC and timeline moving forward now,but no sound out from PC .
Ctrl+m No message log (whatever the detail level),but many thing can be seen in Module tree

@SarthakAnil
Copy link

main stream error: connection error: Connection refused
this is the error i get when i run ./sndcpy on my manjaro any idea what is happening tried removing -Idummy,can see VLC and timeline moving forward now,but no sound out from PC .
Ctrl+m No message log sound still coming from device

@rom1v
Copy link
Owner

rom1v commented Jun 10, 2020

main stream error: connection error: Connection refused

I you get it once, it's expected (cf README).

but no sound out from PC

OK, so it seems several people have this problem.

Could you please build with these changes and run:

diff --git a/app/src/main/java/com/rom1v/sndcpy/RecordService.java b/app/src/main/java/com/rom1v/sndcpy/RecordService.java
index 8486332..f867724 100644
--- a/app/src/main/java/com/rom1v/sndcpy/RecordService.java
+++ b/app/src/main/java/com/rom1v/sndcpy/RecordService.java
@@ -155,6 +155,23 @@ public class RecordService extends Service {
         return builder.build();
     }
 
+    public static String buildPacketString(byte[] data, int offset, int len) {
+        int limit = Math.min(20, len);
+        StringBuilder builder = new StringBuilder();
+        builder.append('[').append(len).append(" bytes] ");
+        for (int i = 0; i < limit; ++i) {
+            if (i != 0) {
+                String sep = i % 4 == 0 ? "  " : " ";
+                builder.append(sep);
+            }
+            builder.append(String.format("%02X", data[offset + i] & 0xff));
+        }
+        if (limit < len) {
+            builder.append("  ... +").append(len - limit).append(" bytes");
+        }
+        return builder.toString();
+    }
+
     private void startRecording() {
         final AudioRecord recorder = createAudioRecord(mediaProjection);
 
@@ -169,6 +186,7 @@ public class RecordService extends Service {
                     byte[] buf = new byte[SAMPLE_RATE * CHANNELS * BUFFER_MS / 1000];
                     while (true) {
                         int r = recorder.read(buf, 0, buf.length);
+                        Log.i(TAG, buildPacketString(buf, 0, buf.length));
                         socket.getOutputStream().write(buf, 0, r);
                     }
                 } catch (IOException e) {

Then look at the output of adb logcat -s sndcpy.

@tz527129804
Copy link
Author

main stream error: connection error: Connection refused

I you get it once, it's expected (cf README).

but no sound out from PC

OK, so it seems several people have this problem.

Could you please build with these changes and run:

diff --git a/app/src/main/java/com/rom1v/sndcpy/RecordService.java b/app/src/main/java/com/rom1v/sndcpy/RecordService.java
index 8486332..f867724 100644
--- a/app/src/main/java/com/rom1v/sndcpy/RecordService.java
+++ b/app/src/main/java/com/rom1v/sndcpy/RecordService.java
@@ -155,6 +155,23 @@ public class RecordService extends Service {
         return builder.build();
     }
 
+    public static String buildPacketString(byte[] data, int offset, int len) {
+        int limit = Math.min(20, len);
+        StringBuilder builder = new StringBuilder();
+        builder.append('[').append(len).append(" bytes] ");
+        for (int i = 0; i < limit; ++i) {
+            if (i != 0) {
+                String sep = i % 4 == 0 ? "  " : " ";
+                builder.append(sep);
+            }
+            builder.append(String.format("%02X", data[offset + i] & 0xff));
+        }
+        if (limit < len) {
+            builder.append("  ... +").append(len - limit).append(" bytes");
+        }
+        return builder.toString();
+    }
+
     private void startRecording() {
         final AudioRecord recorder = createAudioRecord(mediaProjection);
 
@@ -169,6 +186,7 @@ public class RecordService extends Service {
                     byte[] buf = new byte[SAMPLE_RATE * CHANNELS * BUFFER_MS / 1000];
                     while (true) {
                         int r = recorder.read(buf, 0, buf.length);
+                        Log.i(TAG, buildPacketString(buf, 0, buf.length));
                         socket.getOutputStream().write(buf, 0, r);
                     }
                 } catch (IOException e) {

Then look at the output of adb logcat -s sndcpy.

sorry,I'm not a programmer,so I don’t konw which file to change, and how to build....

@tz527129804
Copy link
Author

tz527129804 commented Jun 11, 2020

Then look at the output of adb logcat -s sndcpy.

I did it with google !
here is the log:

$ adb logcat -s sndcpy
--------- beginning of crash
--------- beginning of system
--------- beginning of main
06-11 13:05:48.120 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.164 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.183 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.186 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.205 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.312 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.313 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.332 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.486 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.504 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.614 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.633 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.761 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.780 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.868 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.889 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.891 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.891 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:48.908 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:49.018 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes
06-11 13:05:49.037 30633 1942 I sndcpy : [1440 bytes] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... +1420 bytes

Keep repeating until I close the server.

@rom1v
Copy link
Owner

rom1v commented Jun 11, 2020

OK, so the Playback Capture API on your device does not capture the app sound. What app did you use when you captured these logs?

@tz527129804
Copy link
Author

tz527129804 commented Jun 11, 2020

OK, so the Playback Capture API on your device does not capture the app sound. What app did you use when you captured these logs?

Oh!I just test again.
The yandex browser for android can play sound on PC.
youtube can play!
But Huawei's own browser can't.(Like the log above)
VLC for android can't.(Like the log above)
Wechat can't.(Like the log above)

I think the problem may be related to Huawei system.

@tz527129804
Copy link
Author

OK, so the Playback Capture API on your device does not capture the app sound. What app did you use when you captured these logs?

I think huawei provides different api,and I just use youtube which can work.
Maybe you can test what differences between these apps. Good luck.😀

@1235467
Copy link

1235467 commented Jan 25, 2023

Sound forwarding of Youtube Music and Youtube did work in my case.Testing on EMUI 10.1,a Huawei device.But Poweramp is not working.

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

5 participants