nova-video-player / aos-AVP

NOVA opeN sOurce Video plAyer: main repository to build them all
Apache License 2.0
3.19k stars 190 forks source link

[Bug]: Enabling audio passthrough mode 2 causes video stutter #1073

Open JJD2K opened 5 months ago

JJD2K commented 5 months ago

Problem description

Enabling audio passthrough mode 2 causes video stutter

Steps to reproduce the issue

Enabling audio passthrough mode 2 causes video stutter

Expected behavior

No response

Your phone/tablet/androidTV model

TCL C845X2 - CPU Pentonic 700

Operating system version

Google TV 12

Application version and app store

No response

Additional system information

No response

Debug logs

No response

courville commented 5 months ago

Just for clarification sake, I assume that your TCL Pentonic 700 is an Android TV set and that you have no AV receiver connected to it (sound bar etc.). Is this correct?

JJD2K commented 5 months ago

Hello Of course, I have a receiver (Yamaha RX-V685) connected with eARC that supports all modern audio protocols. Why would I enable audio passthrough if I did not have a receiver? You should check the audio passthrough features if you have time as the audio is a key part of a good movie experience. I do not understand why passthrough is such an issue for all players. Isn't it just passing the RAW audio signal to the output? @courville Quite strange questions ;) "I assume that your TCL Pentonic 700 is an Android TV" - if it wasn't an Android TV how could I use Nova lol I've specified the hardware in the report. Pentatonic 700 is a modern fast MediaTek chip - it is rather capable. That chip is used in many modern TVs. The actual model of the TV if you are interested, is C845X2 (X1 has a slower chip - same TV different hardware)

courville commented 5 months ago

OK now the description of the issue is complete: thanks for the clarification.

BTW you could use an external dongle on the TV for nova, hence the quite strange question (you never know).

Looking at your hardware my first conclusion is that I need the same to reproduce your issue ;-)

I do not have an eARC setup myself.

JJD2K commented 5 months ago

The issue is not related to eARC or ARC itself or hardware itself. I used your player on my old Sony with Android 6/7 and had same experience with passthrough, but yes you need an external receiver to test. I really recommend you to get some decent bookshelf speakers and subwoofer and receiver (I have center too) - the experience is totally different. I had a 7-8 years old Yamaha receiver before this one and it was doing equally well and did support most audio formats. It is worth getting even older TOP model speakers/receivers second hand if you do not wan to spend on audio - you can upgrade and sell them later on. P.S. - do not waste your money on soundbars and crap like that - you can get way better second hand Hi-Fi for that price and way better sound quality.

courville commented 5 months ago

I have a samsung HW-Q990B sound bar and an nvidia shield. I do not have an Android TV, TV set and thus do not test the eARC setup. I could plug the nvidia shield to the tv and get through ARC (my TV does not do eARC) but this is not my setup since I want to use multichannel and I am fine with PCM. Perhaps I can change my setup to test your file this way...

JJD2K commented 5 months ago

Hi Great, but I did not understand how you connect your soundbar. And also "since I want to use multichannel and I am fine with PCM". If you want to use multi-channel you need passthrough - I do not understand that statement. Maybe you meant you don't want to? You do not need to change your setup to test - just enable passthrough Mode 2 and play the file - you will see the stuttering. Btw I sent you some test files on your email.

courville commented 5 months ago

nvidia shield connected directly to soundbar which is connected directly to TV all via HDMI. You can have multichannel without passthrough: e.g. nova decodes AC3 5.1 (or DTS etc.) to multichannel PCM streams that are played fine by the soundbar with surround effect. Passthrough just delegates raw bitstream to the AV receiver to do the decoding. Nova can handle it. However there are a multitude of Android framework issues (due to fragmentation) that makes Android downmix to stereo the streams when using eARC on some platforms. Moreover when having only ARC, the bandwidth is not enough to be able to handle 6 PCM channels (but eARC should be ok).

JJD2K commented 5 months ago

When using PCM I see on my receiver info 2 channel PCM only - both with old tv and receiver and new one too. I've never seen Nova sending more than 2 channels. You can try the sound too with the last sample file that I sent you to your email about the stutter issue. It is DDP5.1 (That video stutter is unrelated to this audio topic) If I keep Nova in PCM mode the sound is just 2 channel and very flat. If I enable passthrough both my TV and receiver display Dolby Digital+ when I play the file and the sound is completely different.

courville commented 5 months ago

I will try your video. What it means is that on your TV it does not output more than 2CH with (e)ARC and this is a problem that should be solved first because I have multichannel without passthrough with my nvidia shield.

JJD2K commented 5 months ago

Strange I see this with both old tv Android TV 6/7/8 and new one Google TV 12 - different brands. My old receiver was Yamaha 5.1, the new one is 7.2 - never seen more than 2 channels PCM when not using passthrough in Nova. In Kodi that file is playing with DD+ too. I see in settings Passthrough output device: AudioTrack(RAW), Android IEC packer. In MXPlayer it plays in stereo - maybe limitation of the libffmpeg that I installed separately for AC3.

courville commented 5 months ago

OK browsing a bit around, it seems that TCL Android TVs do not allow to output multichannel PCM over eARC (though it should be possible) cf. https://www.reddit.com/r/tcltvs/comments/107hkk1/tcl_c935_multichannel_pcm_passthrough_via_earc/ Hence passthrough is the only way to get multichannel output in your case.

JJD2K commented 5 months ago

Those manufacturers do not provide a lot of information. As that never worked on my Sony too it is most likely a limitation of Android TV/ Google TV. Somewhere I read that Kodi passes multi-channel PCM with the configuration that I have - set to 2.0 stereo and enable passthrough. But on the receiver, I see DD+ so probably that info is wrong. If you want me to test something let me know. I do not understand why it is simpler to pass multi-channel PCM rather than the RAW audio data in the file so that the receiver can decode it. Plus that should be better for performance as NOVA will not waste resources to decode the audio input.

JJD2K commented 5 months ago

OK browsing a bit around, it seems that TCL Android TVs do not allow to output multichannel PCM over eARC (though it should be possible) cf. https://www.reddit.com/r/tcltvs/comments/107hkk1/tcl_c935_multichannel_pcm_passthrough_via_earc/ Hence passthrough is the only way to get multichannel output in your case.

Hello Did you test this further? This is not a TCL issue - the same issue is present on my Sony too. There are millions of Android TVs and they get more and more powerful. Even my old Sony had way better performance than Chinese streaming boxes. Having an external player and using extra remote is just annoyance when you have a fast Android TV. Setups with external players will get rare each year. KODI passthrough works perfectly and passes all streams with no issues and no stutters, but I hate the UI of that player. If you have something to test I will be glad to test it - watching 4k HDR downmixed to stereo is not cool at all especially if you have a good sound system.

JJD2K commented 5 months ago

@courville Ok I did some more tests via my Mibox S 4 Android TV 9

  1. Mibox to TV to Receiver via ARC
    • no passthrough - plays 2 channel stereo
    • passthrough mode 2 - plays multichannel - sound is superb, but delayed audio and video stutter

Then I replicated your setup:

  1. Mibox to Receiver to TV ( no arc used)
    • no passthrough - plays 2 channel stereo - my receiver displays stream info - PCM , Channel 2.0 (2/0/---) Sampling 48Khz, Dialogue ---
    • passthrough - plays multichannel - sound is superb, delayed audio and video stutter.

Are you sure that you are listening to multi-channel? Does your sound bar have an info display or any on-screen stream info? I ask that because my receiver has some AI algorithms and tries to simulate multi-channel from stereo when set to certain movie modes and can trick you into thinking that you are listening to multi-channel while the signal is simple stereo.

I see no mutli-channel in Nova. I tried also default mode with force passthrough ticked - same result. I tried multiple sources DDP, DD, EAC3 - always see PCM 2.0

Did I miss something?

courville commented 4 months ago

I do play multichannel on my soundbar with and without passthrough and I get the proper feedback in terms of number of channels (e.g. AAC 5.1 or AC3 5.1 -> MULTI CH PCM with no passthrough and I get "DOLBY DIGITAL" for AC3 with passthrough mode 2 with no delay). I do not use a mibox but nvidia shield for this quick check.

JJD2K commented 4 months ago

That is very strange. Are you sure that you see multi-channel PCM? In normal mode, I do not see multi-channel PCM on any device - TCL, SONY, Mibox. Do I have to set something for multi-channel PCM to work?

courville commented 4 months ago

Nothing is required if you have not forced the stereo down-mixing in nova settings. Note that this could very well be that through HDMI the multi-stream PCM is received by TV and this is the TV that decides to downmix.

JJD2K commented 4 months ago

@courville No that can not be the issue. You have missed my second test: `2. Mibox to Receiver to TV ( no arc used)

no passthrough - plays 2 channel stereo - my receiver displays stream info - PCM , Channel 2.0 (2/0/---) Sampling 48Khz, Dialogue ---`

As you can see there is NO TV involved in this connection. Mibox is connected directly to the Receiver (Amplifier). I see the deteailed steam info on the Receiver OSD. That is why I asked you if your soundbar displays detailed audio stream info denoting more than 2 PCM streams.

The above setup is exactly the same as yours so it should work. Do I have to set something special about sound in Android settings?

courville commented 4 months ago

@JJD2K, OK, I took the mibox and indeed it does only PCM Stereo for some reason very specific to the mibox. Mibox is an amlogic device. I took another amlogic based device: the google chromecast HD and it outputs PCM multichannel for the same movie. I do not believe this is a nova issue. Mibox multichannel PCM support is not clear reading all the thread here https://www.reddit.com/r/AndroidTV/comments/iv3wdt/does_the_mi_box_s_support_multichannel_pcm/

JJD2K commented 4 months ago

Reddit is not a very good source of information, but that guy says exactly the opposite - he says that Mibox DOES support multi-channel PCM: `The Mi Box S doesn't passtrhough TrueHD/DTS-HDMA streams, that's the reason why it's transcoding them to stereo.

But it will passtrough AAC/PCM 5.1 streams directly to your AVR.`

courville commented 4 months ago

In the thread there is indeed claim that it works but contradicted by people trying to make it work. Anyhow, let's not try to focus on reddit. I did the experiment myself and it does not work with mibox for some reason. It works consistently with other devices including amlogic (same SoC brand as the mibox). Bottomline: your experiment is not conclusive on overall nova capacity to output multichannel PCM.

JJD2K commented 4 months ago

https://issuetracker.google.com/issues/235460800?pli=1 https://www.reddit.com/r/AndroidTV/comments/10w5csf/does_the_mi_box_s_support_51_lpcm_audio_with_hdmi/ As far as I see there were multi-channle PCM output issues with Android itself too. If there are different options to output those I will be glad to test them for you.

@courville Do not get me wrong - I do not report issues to discredit Nova. Exactly the oposite. Nova has the best UI and is very well implemented in terms of usability and I really like it. But not being able to play video/audio properly makes it unusable for me. I do understand that it works on some devices, but that does not solve my issue. I test it on 2 different brand TVs and 2 different brand TV boxes and it does not work on 4 out of 4 - they can't all be bad. I repeat again - my purpose is not to discredit you or your player - exactly the opposite - you have done great job so far, but I believe it needs very little more to make it perfect.

P.S. If Kodi can do pass-through on all those devices then obviously it can be done. I doubt that Nova uses any proprietary decoding code. If it uses the same codecs/libs as Kodi then it should be just a matter of configuring them properly to make Nova work too.

JJD2K commented 4 months ago

I tested this further and as far as I can see my receiver somehow makes the stereo PCM from Nova to sound like 5.1 using a NEO6 Cinema mode. (It displays that the signal from Nova is PCM 2.0) That is why I asked you multiple times if you are really sure that your soundbar is receiving multi-channel PCM and not just stereo.

It also seems that Android TV 12 can not pass-through True HD, so I played with KODI settings. My receiver does support True HD, but if I enable pass-through for it in KODI, I get no sound. KODI can properly transcode unsupported formats if you:

  1. Set channels to 2.0
  2. "Enable Dolby Digital (AC3) transcoding" ON
  3. Disable "TrueHD capable receiver"

If I set those settings I get True HD audio converted to multi-channel - I see Dolby Digital on the receiver screen - not PCM.

I contacted Yamaha and they told me that if I press the "STRAIGHT" button the speakers displayed on the receiver screen are the actual audio channels received. In case of nova I see only left and right so the PCM is definitely stereo. Maybe this helps.

Is there any ADB command like the ones for the TV screen modes that I can use to check what audio signal Nova is outputting?

courville commented 4 months ago

@JJD2K these are good comments. I do have multi-channel output with nova in the configurations that I highlighted: the AV receiver does not do funky multi-channel up-mixing. I acknowledge that the Kodi way to recode to AC3 5.1 is the only universal way to get multi-channel passthrough (due to Android fragmentation and compatibility issues between devices) cf. https://github.com/nova-video-player/aos-AVP/issues/430: it has been in my favorite items TODO list for a while.

JJD2K commented 4 months ago

@courville Well if you can implement that it will be really great!

Just to mention another observation is that if I enable passthrough in NOVA the volume is much louder than the PCM mode. Not that it matters - just an observation.

JJD2K commented 3 months ago

@courville Are there any requirements to get multichannel PCM? I can not get this to work neither on Android TV not on external MiBox S. Are there any options that I can try? Any adb commands?

phhusson commented 3 months ago

There is no Google requirement for an Android TV device to support multichannel PCM if that's your question, so many ATV devices don't support multichannel PCM at all.

JJD2K commented 3 months ago

@courville Ok I did more test and there are some interesting things I found. I disabled passthrough in Nova and

  1. I tested with optical cable and the receiver displays DD and plays properly - that is so strange. Why?
  2. I connected HDMI arc and I get PCM again, BUT when I change digital audio output on the TV from PCM to AUTO I see on the receiver displayed DTHD for a second and it goes back to PCM again. Could that be because of incompatibility with that multichannel PCM stream? Are there any extra settings for that stream that might be necessary to be set in the code?

This is really weird.

Ok this could be the reason. I do not know why that multichannel PCM is detected as Dolby True HD, but probably that is why it does not work. For some reason True HD does not work in KODI too - probably unsupported by Android or the TV so I disable True HD passthrough in KODI and it transcodes it to Dolby Digital. If Nova sends multichannel PCM which is detected as DTHD probably that is why the TV switches to stereo PCM. I tested this with EAC3 5.1 file.

If you can provide a version with different multichannel PCM output I will be glad to test. If there are different options for that stream you can add them as different options in the passthrough settings for a test.

JJD2K commented 3 months ago

@courville The issue with multichannel PCM is in NOVA, not in the devices. I installed PLEX and Plex server and the TV does play True HD as multichannel PCM on the same files. When playing a True HD file with Plex the receiver displays DTHD for a second and then switches to multichannel PCM.

You did not reply my last post - maybe you are busy.

If you can provide a version with different multichannel PCM output I will be glad to test. If there are different options for that stream you can add them as different options in the passthrough settings for a test.

P.S. Plex is using Google ExoPlayer and the sources are available if that can help: https://github.com/google/ExoPlayer Just Player uses ExoPlayer too and outputs multichannel PCM too.