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

Eac3 audio in video #10791

Closed
carrinhoff opened this issue Nov 17, 2022 · 6 comments
Closed

Eac3 audio in video #10791

carrinhoff opened this issue Nov 17, 2022 · 6 comments
Assignees
Labels

Comments

@carrinhoff
Copy link

I have a video that has "eac3 audio codec" , the video works perfectly but with no audio.
I've tried to use ffmpeg , i did built .aar successfully and added to the libs of my project, but when I call "Ffmpeg.isAvailable" , I always get "false" as response, so I assume is not working.

My .aar has 13kb of size and I added eac3 to the decoders.

What should I do now ? I really need to use exoplayer I didn't want to switch.
Thanks.

@icbaker
Copy link
Collaborator

icbaker commented Nov 18, 2022

but when I call "Ffmpeg.isAvailable" , I always get "false" as response, so I assume is not working.

This sounds like a problem with the way you're building or depending on the ffmpeg extension, rather than anything specific about eac3. Have you made sure to follow the full instructions for building the extension? https://github.com/google/ExoPlayer/blob/release-v2/extensions/ffmpeg/README.md

It's unlikely we can offer much detailed support with the specifics of your build setup I'm afraid.

@carrinhoff
Copy link
Author

I did, i have placed Exoplayer locally and have imported every library I needed like this

implementation project(':exoplayer-library-core') implementation project(':exoplayer-extension-cast') implementation project(':exoplayer-library-hls') implementation project(':exoplayer-library-ui')

After that i followed the guides, I have used ndk 21 , and now i have a FFMPEG folder inside Exoplayer/extesions/ffmpeg/src/main/jni...

And after that
exoPlayer = SimpleExoPlayer.Builder(this,mRenderFactory).build() mRenderFactory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON )

And I still have no sound , FFmpeg.isAvaible continues to give false but i'm 100% that I didnt skip any step from this guide
https://github.com/google/ExoPlayer/blob/release-v2/extensions/ffmpeg/README.md

@carrinhoff
Copy link
Author

If I try to do this step -> ./gradlew extension-ffmpeg:assembleRelease that i found on another tutorial, i go the follow error

`

Task :extension-ffmpeg:buildCMakeRelWithDebInfo[arm64-v8a] FAILED
C/C++: ninja: error: 'C:/Users/Fabio/ExoPlayer/extensions/ffmpeg/src/main/jni/ffmpeg/android-libs/arm64-v8a/libswresample.a', needed by 'C:/Users/Fabio/ExoPlayer/extensions/ffmpeg/buildout/intermediates/cxx/RelWithDebInfo/6p3re6p1
/obj/arm64-v8a/libffmpegJNI.so', missing and no known rule to make it

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':extension-ffmpeg:buildCMakeRelWithDebInfo[arm64-v8a]'.

Build command failed.
Error while executing process C:\Users\Fabio\AppData\Local\Android\Sdk\cmake\3.22.1\bin\ninja.exe with arguments {-C C:\Users\Fabio\ExoPlayer\extensions\ffmpeg.cxx\RelWithDebInfo\6p3re6p1\arm64-v8a ffmpegJNI}
ninja: Entering directory `C:\Users\Fabio\ExoPlayer\extensions\ffmpeg.cxx\RelWithDebInfo\6p3re6p1\arm64-v8a'

ninja: error: 'C:/Users/Fabio/ExoPlayer/extensions/ffmpeg/src/main/jni/ffmpeg/android-libs/arm64-v8a/libswresample.a', needed by 'C:/Users/Fabio/ExoPlayer/extensions/ffmpeg/buildout/intermediates/cxx/RelWithDebInfo/6p3re6p1/obj/
arm64-v8a/libffmpegJNI.so', missing and no known rule to make it

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 12s
2 actionable tasks: 2 executed
`

@carrinhoff
Copy link
Author

Found the problem

It's impossible to do this correctly:

cd "${FFMPEG_MODULE_PATH}/jni" && \ ./build_ffmpeg.sh \ "${FFMPEG_MODULE_PATH}" "${NDK_PATH}" "${HOST_PLATFORM}" "${ENABLED_DECODERS[@]}"

because we get the following error :

/android-ndk-r21e/toolchains/llvm/prebuilt/windows-x86_64/bin/x86_64-linux-android21-pkg-config not found, library detection may fail.

There isn't any pkg-config inside NDK , how this should even work ?

@carrinhoff
Copy link
Author

So I found the solution and I will post here to help anothers with the same problem.
The exoplayer guide : https://github.com/google/ExoPlayer/blob/release-v2/extensions/ffmpeg/README.md
is incomplete for windows.

Inside build_ffmpeg.sh we have a command called "make" (used in linux) but windows doesn't know it , so you have to install chocolatey on power shell , and then "choco install make", after that you need to close all terminals and open again and from that you follow those exoplayer guidelines and everything should work fine.

To test if everything is ok you must receive true from calling "Ffmpeg.isAvailable" inside your project.
Now i have sound on my videos.

Btw, exoplayer team please update the documentation with this step.

@icbaker
Copy link
Collaborator

icbaker commented Nov 21, 2022

Glad you got it resolved!

Btw, exoplayer team please update the documentation with this step.

The instructions currently make clear they're not tested on Windows. I will take a look at adding set -e to the build_ffmpeg.sh script so that any errors cause it to exit immediately - I think that should make it exit when it can't find the make command, and the resulting error should be fairly clear (that you need to install make). We don't have an opnion on where people install make from, so I don't think it would be appropriate to explicitly document that people use chocolatey to achieve this.

I'm going to close this since the question has been solved.

@icbaker icbaker closed this as completed Nov 21, 2022
microkatz pushed a commit that referenced this issue Nov 22, 2022
These flags ensure that any errors cause the script to exit (instead of
just carrying on) (`-e`) and that any unrecognised substitution variables
cause an error instead of silently resolving to an empty string (`-u`).

Issues like Issue: #10791 should be more quickly resolved with
`set -e` because the script will clearly fail with an error like
`make: command not found` which would give the user a clear pointer
towards the cause of the problem.

#minor-release

PiperOrigin-RevId: 490001419
microkatz pushed a commit to androidx/media that referenced this issue Nov 22, 2022
These flags ensure that any errors cause the script to exit (instead of
just carrying on) (`-e`) and that any unrecognised substitution variables
cause an error instead of silently resolving to an empty string (`-u`).

Issues like Issue: google/ExoPlayer#10791 should be more quickly resolved with
`set -e` because the script will clearly fail with an error like
`make: command not found` which would give the user a clear pointer
towards the cause of the problem.

#minor-release

PiperOrigin-RevId: 490001419
@google google locked and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants