- Home /
How to add audio to a video file within Unity,How can I add audio to a video from within Unity
Hi everyone,
I am trying to figure out how to add an audio file (or files) to a video from within Unity. If possible I'd like to avoid using ffmpeg, as it seems more complicated than what I need. For platforms I am aiming at iOS and Android. Any help would be appreciated!
Context:
I am working on an app in which at the end of gameplay, the user can choose to save a playback of their finished session. The way the app works, the users are combining a series of short video clips into a longer single sequence. The videos are rendered using material overrides, and each clip is made up of multiple layers with depth between them.
The first limitation is that I am interposing dynamic objects between the different layers of the individual videos, so in order to get their completed session exactly as it was in game, I am recording the in-game camera view to generate the video.
The second limitation is caused by the first, and is that I cannot record the in-game audio when I am recording the playback, due to the restriction that Android devices cannot record internal audio.
Which lead me to recording the video silently, and adding the audio (which is not dynamic,) to the finished video afterwards. Each individual video clip that makes up the larger sequence has its own audio clip associated that plays simultaneously. I imagine it may be easier to combine these into a single audio clip before adding it to the video, but I am not certain.
This needs to be done within Unity, as I'd like to avoid a server-based solution where I assemble video elsewhere, and the sequences users create are pretty dynamic. The intent is to allow users to share these videos after completion, and without interrupting gameplay by bogging their devices down with rendering.
Thanks!
Your answer
Follow this Question
Related Questions
VideoPlayer: No audio when playing from StreamingAssets 1 Answer
Manage AudioMixing with Video 0 Answers
playing audio from a video clip 0 Answers
Media Formats and Licensing in Unity 0 Answers
Make Cinema 1 Answer