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

[Bug]: sound not working except for termux-media-player #3960

Open
edoardomazzella opened this issue May 21, 2024 · 9 comments
Open

[Bug]: sound not working except for termux-media-player #3960

edoardomazzella opened this issue May 21, 2024 · 9 comments

Comments

@edoardomazzella
Copy link

Problem description

Using Termux with xfce desktop environment installed (no distro), as per Termux wiki, I am not able to play sound from any of the installed packages (Firefox, vlc) except for termux-media-player using the terminal.

Steps to reproduce the behavior.

Install termux and termux API, upgrade packages
install tigervnc and xfce
Install Firefox or any available media player (cantara, vlc) and try to play a file audio.

What is the expected behavior?

I can hear sound when using Firefox and media players

System information

  • Termux application version: 0.118.0
  • Android OS version: 14
  • Device model: samsung tab s9 ultra
@Manamama
Copy link

Manamama commented May 29, 2024

Check if pulseaudio is installed:
pulseaudio/stable,now 17.0-1 aarch64 [installed,automatic]. If so, this plays sound and video (via X11):

~/downloads $ mplayer /storage/7B27-F244/Videos_Ext_SD/Watch_me/NASA-Voyager-Jupiter.mp4 MPlayer 1.5-17.0.2 (C) 2000-2022 MPlayer Team Playing /storage/7B27-F244/Videos_Ext_SD/Watch_me/NASA-Voyager-Jupiter.mp4. libavformat version 60.16.100 (external) libavformat file format detected. [mov,mp4,m4a,3gp,3g2,mj2 @ 0x74d1c22f20]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol [lavf] stream 0: video (h264), -vid 0 [lavf] stream 1: audio (aac), -aid 0, -alang und VIDEO: [H264] 480x360 24bpp 25.000 fps 66.1 kbps ( 8.1 kbyte/s) [VO_XV] It seems there is no Xvideo support for your video card available. [VO_XV] Run 'xvinfo' to verify its Xv support and read [VO_XV] DOCS/HTML/en/video.html#xv! [VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers. [VO_XV] Try -vo x11. ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family libavcodec version 60.31.102 (external) Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264) ========================================================================== Clip info: major_brand: mp42 minor_version: 0 compatible_brands: isommp42 encoder: Google Load subtitles in /storage/7B27-F244/Videos_Ext_SD/Watch_me/ ========================================================================== Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders AUDIO: 44100 Hz, 2 ch, floatle, 96.0 kbit/3.40% (ratio: 12000->352800) Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio)) ========================================================================== AO: [pulse] 44100Hz 2ch floatle (4 bytes per sample) Starting playback... Movie-Aspect is 1.33:1 - prescaling to correct movie aspect. VO: [x11] 480x360 => 480x360 Planar YV12 [swscaler @ 0x74cfc65a88]No accelerated colorspace conversion found from yuv420p to bgra. [swscaler @ 0x74cfc65a88]using unscaled yuv420p -> bgra special converter A: 28.3 V: 28.3 A-V: 0.000 ct: 0.001 0/ 0

@mzen17
Copy link

mzen17 commented May 30, 2024

Take a look at this issue reported about pulseaudio not working on OneUI 6.1.
termux/termux-packages#19623

@Manamama
Copy link

Likely these tips.
I have just tested vlcplayer and firefox in X11 and both have sound via pulseaudio, as well. My preload is empty tho:
~ $ echo $PRELOAD

~ $
, while the rest:

PATH: /data/data/com.termux/files/usr/google-cloud-sdk/bin:/data/data/com.termux/files/home/.opam/default/bin:/data/data/com.termux/files/usr/bin:/system/bin/:/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/home/.local/bin

LD_LIBRARY_PATH: /data/data/com.termux/files/usr/lib:/data/data/com.termux/files/usr/lib/jvm/java-17-openjdk/lib/:

CC: clang
CXX: clang++
CFLAGS:
CXXFLAGS:
LDFLAGS:
CPPFLAGS:
PREFIX is: /data/data/com.termux/files/usr
LD_LIBRARY_PATH is:
LD_PRELOAD is:
LLVM_CONFIG is:
C_INCLUDE_PATH is:

@mhdtyb
Copy link

mhdtyb commented Jun 6, 2024

i am on Android 14,using Debian with xfce in proot-distro, i installed all required packages in termux and in proot-distro, i do all required steps, but when i runned the gui everything works exept pulseaudio.
pulseaudio worked in termux (Native GUI in termux), and worked in ubuntu proot-distro, but not worked in Debian

@Manamama
Copy link

i can confirm as per @mhdtyb - after some updates:

Termux:

play wiersze1.mp3

wiersze1.mp3:

 File Size: 108k      Bit Rate: 128k
  Encoding: MPEG audio
  Channels: 2 @ 16-bit
Samplerate: 48000Hz
Replaygain: off
  Duration: 00:00:06.77

In:0.00% 00:00:00.00 [00:00:06.77] Out:0...

But prooted Debian:

root@localhost:~/downloads_Termux# play wiersze1.mp3
play FAIL ao: Could not open device: error 5
play FAIL sox: Sorry, there is no default audio device configured
root@localhost:~/downloads_Termux#

even after running pulseaudio there.

@sylirre
Copy link
Member

sylirre commented Jun 10, 2024

Pulseaudio can be used only in Termux because only such version is patched to be able play sound on Android.

@01101010110
Copy link

01101010110 commented Jun 22, 2024

Hello here is a command that will fix this for proot distro, but run it in Termux directly, not your proot environment:

echo -e 'LD_PRELOAD=/system/lib64/libskcodec.so\npulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1' | tee -a ../usr/etc/bash.bashrc

Using that command shortened from a command posted on another gh issues link shared in this thread:
https://xdaforums.com/t/guide-no-root-how-to-install-debian-or-ubuntu-environments-on-android-in-termux-using-proot-distro.4570275/post-89567377

We were able to get Samsung devices like the Tab S9 to play audio in Debian Proot. Proof is on the XDA link

@mhdtyb
Copy link

mhdtyb commented Jun 22, 2024

Hello here is a command that will fix this for proot distro, but run it in Termux directly, not your proot environment:

echo -e 'LD_PRELOAD=/system/lib64/libskcodec.so\npulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1' | tee -a ../usr/etc/bash.bashrc

Using that command shortened from a command posted on another gh issues link shared in this thread: https://xdaforums.com/t/guide-no-root-how-to-install-debian-or-ubuntu-environments-on-android-in-termux-using-proot-distro.4570275/post-89567377

We were able to get Samsung devices like the Tab S9 to play audio in Debian Proot. Proof is on the XDA link

i already know that we can do that but i want the developer to make as the default config in previous updates

@Manamama
Copy link

There is also this ugly trick ;):

play_file() {
    local file_path="$PWD/$1"
    termux-media-player play "/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/debian$file_path"
}

Of course, after aliasing or linking:

root@localhost:~# which termux-media-player
/data/data/com.termux/files/usr/bin//termux-media-player
root@localhost:~#

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

No branches or pull requests

6 participants