Search Unity

Audio Extract audio from video

Discussion in 'Audio & Video' started by Sevendoor, Nov 29, 2019.

  1. Sevendoor

    Sevendoor

    Joined:
    Nov 19, 2019
    Posts:
    3
    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.
     
  2. harini

    harini

    Unity Technologies

    Joined:
    May 28, 2015
    Posts:
    45
    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?
     
    zacharyaghaizu and Ikaro88 like this.
  3. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    300
    I need to extract the audio from the video to play it inside unity can you help me?
     
  4. spitzerpl

    spitzerpl

    Joined:
    Jul 16, 2020
    Posts:
    3
    Is there no other way?
     
  5. zacharyaghaizu

    zacharyaghaizu

    Joined:
    Aug 14, 2020
    Posts:
    65
    Yes, is there a way?
     
  6. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    bump. Is there a way to do this?
     
  7. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    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.
     
  8. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    @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?
     
  9. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    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.
     
  10. Foreman_Dev

    Foreman_Dev

    Joined:
    Feb 4, 2018
    Posts:
    82