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

AudioTrack init failed #10802

Open
6 tasks done
dezlov opened this issue Jan 29, 2024 · 19 comments
Open
6 tasks done

AudioTrack init failed #10802

dezlov opened this issue Jan 29, 2024 · 19 comments
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background) waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed.

Comments

@dezlov
Copy link

dezlov commented Jan 29, 2024

Checklist

  • I am able to reproduce the bug with the latest version given here: CLICK THIS LINK.
  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have read the FAQ and my problem isn't listed.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.

Affected version

0.26.1

Steps to reproduce the bug

  1. Open any video.
  2. Press play.

Expected behavior

Video starts playing.

Actual behavior

Error occurs.

Screenshots/Screen recordings

No response

Logs

Exception

  • User Action: play stream
  • Request: Player error[type=ERROR_CODE_AUDIO_TRACK_INIT_FAILED] occurred while playing https://www.youtube.com/watch?v=LXb3EKWsInQ
  • Content Country: US
  • Content Language: en-US
  • App Language: en_US
  • Service: YouTube
  • Version: 0.26.1
  • OS: Linux Android 11 - 30
Crash log

com.google.android.exoplayer2.ExoPlaybackException: MediaCodecAudioRenderer error, index=1, format=Format(140, null, null, audio/mp4a-latm, mp4a.40.2, 130535, und, [-1, -1, -1.0], [2, 44100]), format_supported=YES
	at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:578)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:223)
	at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: com.google.android.exoplayer2.audio.AudioSink$InitializationException: AudioTrack init failed 0 Config(44100, 12, 60320) Format(null, null, null, audio/raw, null, -1, null, [-1, -1, -1.0], [2, 44100])
	at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.buildAudioTrack(DefaultAudioSink.java:2136)
	at com.google.android.exoplayer2.audio.DefaultAudioSink.buildAudioTrack(DefaultAudioSink.java:1073)
	at com.google.android.exoplayer2.audio.DefaultAudioSink.buildAudioTrackWithRetry(DefaultAudioSink.java:1051)
	at com.google.android.exoplayer2.audio.DefaultAudioSink.initializeAudioTrack(DefaultAudioSink.java:843)
	at com.google.android.exoplayer2.audio.DefaultAudioSink.handleBuffer(DefaultAudioSink.java:929)
	at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.processOutputBuffer(MediaCodecAudioRenderer.java:709)
	at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1889)
	at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:782)
	at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1007)
	at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:502)
	... 3 more
	Suppressed: com.google.android.exoplayer2.audio.AudioSink$InitializationException: AudioTrack init failed 0 Config(44100, 12, 60320) Format(null, null, null, audio/raw, null, -1, null, [-1, -1, -1.0], [2, 44100])
		... 13 more
	Caused by: java.lang.UnsupportedOperationException: Cannot create AudioTrack
		at android.media.AudioTrack$Builder.build(AudioTrack.java:1294)
		at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration$$ExternalSyntheticApiModelOutline6.m(R8$$SyntheticClass:0)
		at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.createAudioTrackV29(DefaultAudioSink.java:2185)
		at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.createAudioTrack(DefaultAudioSink.java:2163)
		at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.buildAudioTrack(DefaultAudioSink.java:2128)
		... 12 more
Caused by: java.lang.UnsupportedOperationException: Cannot create AudioTrack
	at android.media.AudioTrack$Builder.build(AudioTrack.java:1294)
	at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration$$ExternalSyntheticApiModelOutline6.m(R8$$SyntheticClass:0)
	at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.createAudioTrackV29(DefaultAudioSink.java:2185)
	at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.createAudioTrack(DefaultAudioSink.java:2163)
	at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.buildAudioTrack(DefaultAudioSink.java:2128)
	... 12 more


Affected Android/Custom ROM version

Android 11

Affected device model

Ugoos AM8

Additional information

Other video apps work fine. YouTube plays fine in a web browser.

@dezlov dezlov added bug Issue is related to a bug needs triage Issue is not yet ready for PR authors to take up labels Jan 29, 2024
@dezlov
Copy link
Author

dezlov commented Jan 29, 2024

If I configure NewPipe to play video and audio in an external player (VLC), then static videos play fine at 720p and lower, but no audio in 1080p videos. It also can't play "live" videos in this configuration, it says VLC is not found and offers to install it. Tried reinstalling VLC from Google Play and F-Droid, but it made no difference.

@opusforlife2
Copy link
Collaborator

Try restarting?

@opusforlife2 opusforlife2 added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 1, 2024
@dezlov
Copy link
Author

dezlov commented Feb 1, 2024

Try restarting?

Yes. Tried restarting the box and reinstalling NewPipe from different sources.

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 1, 2024
@opusforlife2
Copy link
Collaborator

And a lower resolution/codec combo?

@opusforlife2 opusforlife2 added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 1, 2024
@dezlov
Copy link
Author

dezlov commented Feb 1, 2024

And a lower resolution/codec combo?

I tried changing the video/audio settings, from defaults to the following:

  • Default resolution: 720p60 to 360p
  • Default video format: MPEG-4 to WebM
  • Default audio format: M4A to WebM

I get the same error.

Any other settings worth tinkering with?

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 1, 2024
@opusforlife2
Copy link
Collaborator

Ugoos AM8

Never heard of this device before, so you should also test on a different device. Might be an OS/device bug.

@opusforlife2 opusforlife2 added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 2, 2024
@dezlov
Copy link
Author

dezlov commented Feb 2, 2024

Ugoos AM8

Never heard of this device before, so you should also test on a different device. Might be an OS/device bug.

Ugoos has been around for a decade or two, developing Android TV boxes. Ugoos AM8 is one of the latest boxes that was launched in 2023 with Android 11.0 and Amlogic S928X-J, which outperforms most Android boxes in existence today.

The official list of supported codecs/formats is quite extensive:

− AV1 [email protected] up to 8Kx4K@60fps
− VP9 [email protected] up to 8Kx4K@60fps
− H.265 HEVC [email protected] up to 8Kx4K@60fps
− AVS3 Phase 1 up to 8Kx4K@60fps
− AVS2-P2 Profile up to 8Kx4K@60fps
− H.264 AVC [email protected] up to 4Kx2K@30fps
− MPEG-4 ASP@L5 up to 1080P@60fps (ISO-14496)
− WMV/VC-1 SP/MP/AP up to 1080P@60fps
− AVS-P16(AVS+) /AVS-P2 JiZhun Profile up to 1080P@60fps
− MPEG-2 MP/HL up to 1080P@60fps (ISO-13818)
− MPEG-1 MP/HL up to 1080P@60fps (ISO-11172)
− Multiple language and multiple format sub-title video support
− MJPEG and JPEG unlimited pixel resolution decoding (ISO/IEC-10918)
− Supports JPEG thumbnail, scaling, rotation and transition effects

I also have a couple of old boxes MINIX U22 (Android 9.0) where NewPipe is working fine.

All other apps work fine on Ugoos AM8, including video playback of various formats and in 4K, even on YouTube. But NewPipe is not playing anything. Is it possible that NewPipe is not using the Android API correctly?

If you believe it is a device/OS issue, can you give me any more details, so I could report this issue to Ugoos?

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 2, 2024
@opusforlife2
Copy link
Collaborator

Well, the easiest way to rule this out would be to test another device first, with the exact same settings as you currently have.

@opusforlife2 opusforlife2 added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 2, 2024
@dezlov
Copy link
Author

dezlov commented Feb 4, 2024

Well, the easiest way to rule this out would be to test another device first, with the exact same settings as you currently have.

I don't have another such box at hand, but I will try to get the manufacturer to try it.

However, the fact that all other video/audio apps work without issues suggests that it might be an issue with NewPipe rather than the device. Is it something that you can investigate further?

Can you help decipher the error log to understand the media format that NewPipe is trying to play?

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 4, 2024
@opusforlife2
Copy link
Collaborator

I don't have another such box at hand

That's not what I meant. I mean try it on your phone and some other device that's not the same OS and manufacturer, so that we can rule them out as problems.

Never heard of this device before, so you should also test on a different device. Might be an OS/device bug.

You can't check if it's a device/OS bug if you're testing on the same OS and maker.

@opusforlife2 opusforlife2 added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 4, 2024
@dezlov
Copy link
Author

dezlov commented Feb 4, 2024

I mean try it on your phone and some other device that's not the same OS and manufacturer, so that we can rule them out as problems.

NewPipe does work fine on my phone and on another brand of Android boxes I have, but I don't see how this rules out anything. There can still be a problem with either NewPipe or Ugoos AM8, or both.

You can't check if it's a device/OS bug if you're testing on the same OS and maker.

Well, if it would work on one Ugoos AM8 but not another Ugoos AM8, then it could indicate a manufacturing or software defect in a particular box rather than a more general incompatibility between NewPipe and Ugoos AM8.

I'm guessing it's probably the latter, i.e. a general incompatibility between NewPipe and Ugoos AM8, because all other apps work fine on this device. I would imagine the manufacturer will say that since all other apps work fine, then it's probably a software defect in NewPipe.

Can you help decipher the error log to understand the media format that NewPipe is trying to play and any other interesting details that might help the manufacturer investigate this issue?

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 4, 2024
@opusforlife2
Copy link
Collaborator

but I don't see how this rules out anything

It helps us know that there's nothing wrong with your network or other settings/config/setup. Better to conduct a simple test whose answer you probably know, than to not and later feel silly if the test could have helped pinpoint the problem.

Now that we know the problem is between Newpipe and that particular device, could you try Just Player from F-Droid? It's also based on Exoplayer like Newpipe, and will let us know if the problem lies there. (If it also doesn't work but you don't get a direct crash report, maybe also install Scoop or use adb logcat to obtain the crash log).

@opusforlife2 opusforlife2 added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 4, 2024
@dezlov
Copy link
Author

dezlov commented Feb 9, 2024

I tried installing Just Player from F-Droid, but I'm not sure if it is the right app. It was last updated more than 10 years ago, in 2013. When installing, it says that the app might misbehave as it was developed for a much older version of Android. It is also advertised as a music player, rather than a video player. Is that the right app?

I also found a similarly named app Just (Video) Player in Google Play Store, with source code available in GitHub. I installed this one too.

Simply installing either of these two apps didn't change anything regarding the issue in NewPipe. It still couldn't to play any video with the default configuration.

Do I need to somehow instruct NewPipe to use a different video player API for native playback?

I can configure NewPipe to use an external player, e.g. VLC or Just (Video) Player, but as mentioned earlier it results in degraded functionality, i.e. no audio in 1080p, can't play live streams.

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 9, 2024
@opusforlife2
Copy link
Collaborator

I also found a similarly named app

Yes that's the one. This is also available on F-Droid. I didn't know about that abandoned app. Sorry for the confusion. xD

The idea here is to test any video file you happen to have in Just (Video) Player as a standalone. This app has nothing to do with Newpipe. There is no interaction or dependency between them.

But you must find a video whose audio track codec is m4a/aac, matching your crash report. If you don't have any such video available, then you could use yt-dlp to download the exact video you've linked in your crash report, with the exact stream format your crash report shows (which is 140). If this file plays just fine in Just Player, then we can be more certain that the problem is in Newpipe.

Here's the shell command you need, in case you've never used yt-dlp before: yt-dlp -f 140 https://www.youtube.com/watch?v=LXb3EKWsInQ

You could also use yt-dlg if you're more comfortable with GUIs.

@opusforlife2 opusforlife2 added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 9, 2024
@dezlov
Copy link
Author

dezlov commented Feb 17, 2024

I followed your instructions.

The audio file played without issues in all 3 players:

  • Just Player (version 3.37 jp.co.kayo.android.localplayer)
  • MusicPlayer (version 31 com.droidlogic.musicplayer)
  • VLC (latest version from Google Play)

The command used to download the audio track:

$ ./yt-dlp.sh -f 140 https://www.youtube.com/watch?v=LXb3EKWsInQ
...
[info] LXb3EKWsInQ: Downloading 1 format(s): 140
[download] Destination: COSTA RICA IN 4K 60fps HDR (ULTRA HD) [LXb3EKWsInQ].m4a
[download] 100% of    4.84MiB in 00:00:00 at 8.54MiB/s
[FixupM4a] Correcting container of "COSTA RICA IN 4K 60fps HDR (ULTRA HD) [LXb3EKWsInQ].m4a"

The specification of format "140", for reference:

$ ./yt-dlp.sh -f - https://www.youtube.com/watch?v=LXb3EKWsInQ
...
[info] Available formats for LXb3EKWsInQ:
ID  EXT   RESOLUTION FPS HDR CH │   FILESIZE    TBR PROTO │ VCODEC           VBR ACODEC      ABR ASR MORE INFO
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
...
599 m4a   audio only          2 │    1.15MiB    31k https │ audio only           mp4a.40.5   31k 22k ultralow, m4a_dash
600 webm  audio only          2 │    1.28MiB    34k https │ audio only           opus        34k 48k ultralow, webm_dash
139 m4a   audio only          2 │    1.83MiB    49k https │ audio only           mp4a.40.5   49k 22k low, m4a_dash
249 webm  audio only          2 │    1.88MiB    50k https │ audio only           opus        50k 48k low, webm_dash
250 webm  audio only          2 │    2.51MiB    67k https │ audio only           opus        67k 48k low, webm_dash
140 m4a   audio only          2 │    4.84MiB   129k https │ audio only           mp4a.40.2  129k 44k medium, m4a_dash
251 webm  audio only          2 │    4.96MiB   133k https │ audio only           opus       133k 48k medium, webm_dash
...

MediaInfo output:

General
Complete name                            : E:\COSTA RICA IN 4K 60fps HDR (ULTRA HD) [LXb3EKWsInQ].m4a
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 4.84 MiB
Duration                                 : 5 min 13 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 129 kb/s
Writing application                      : Lavf58.45.100

Audio
ID                                       : 1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 5 min 13 s
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 4.79 MiB (99%)
Title                                    : ISO Media file produced by Google Inc.
Default                                  : Yes
Alternate group                          : 1

@github-actions github-actions bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Feb 17, 2024
@opusforlife2
Copy link
Collaborator

Awesome! Thanks for being thorough. This makes it certain that the bug is in Newpipe somewhere. Let's see what the devs say.

@opusforlife2 opusforlife2 added player Issues related to any player (main, popup and background) and removed needs triage Issue is not yet ready for PR authors to take up labels Feb 20, 2024
@Spica2000
Copy link

I have the same problem on Ugoos X4 Cube, Android 11. Ugoos is one of the best TV boxes, please fix Newpipe. Thank you!

@dezlov
Copy link
Author

dezlov commented Mar 8, 2024

Any thoughts on how to fix this?

@opusforlife2
Copy link
Collaborator

I can't believe I didn't ask you to try the three Exoplayer settings toggles. Maybe those might work.

@opusforlife2 opusforlife2 added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background) waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed.
Projects
None yet
Development

No branches or pull requests

3 participants