Extract audio from video

Hello.
I’m currently working on the development
I extracted a .mp3 file with MediaMuxer because I need to extract audio from my video file.
However, for .mp3 files extracted with MediaMuxer, they could not be called up to UnityWebRequest or WWW.
extracted with MediaMuxerIt felt like I was like changed only in video file extension of the mp3.
Is there any other way besides MediaMuxer?

FFmpeg may not be used due to license problem.

Are you looking to extract out the audio to play it inside unity itself as an audio source or do you want to save it to disk?

2 Likes

I need to extract the audio from the video to play it inside unity can you help me?

Is there no other way?

Yes, is there a way?

bump. Is there a way to do this?

The question was, “Are you looking to extract out the audio to play it inside unity itself as an audio source or do you want to save it to disk?” It is important because you have two completely different answers. If you want to play the video inside an AudioSource, you can do it by changing the AudioSourceOutput to AudioSource and setting the AudioSource. If you want to save the audio from the video to the disk, we don’t have a good solution right now. You can extract the audio while playing the video, but it means a lot of GPU is wasted on decoding the video. After that, you would need to save it in a good formated MP3 which is not trivial and would need an external library.

@The_Island It’s the former. I don’t want to save the audio to disk. I want to play a video in an audio source. I want to get the audio from a video and play it in an audio source. How can I do this? Can you show some screenshots?

8311233--1090461--upload_2022-7-25_23-17-4.png
Make sure you have a video clip selected if the source is Video Clip or you will not see the AudioSource field.

Hey @The_Island , I think @Marks4 would like to know how the Unity video player is actually extracting audio from the video and outputting it to an audio source, per this thread: How can I extract the audio from a video tag in the js side?