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

Video volume increases abruptly at the end + audio mixing cracks #930

Closed
yuvraj108c opened this issue Apr 18, 2022 · 4 comments · Fixed by #965
Closed

Video volume increases abruptly at the end + audio mixing cracks #930

yuvraj108c opened this issue Apr 18, 2022 · 4 comments · Fixed by #965
Labels
bug Something isn't working

Comments

@yuvraj108c
Copy link
Contributor

yuvraj108c commented Apr 18, 2022

I have rendered the following video for a project using remotion. It consists of a background music, alongside with some voice overs played at different time frames.

video.mp4
  • If you listen carefully, there is an audio crack when the second voiceover (audio_2) starts playing. The same problem occurs if I add audio_3, audio_4 etc
  • At the end of the video, the volume increases unexpectedly.

The video works fine during the preview mode. I believe the video render process is causing this weird bug. I have crosschecked the audio files and they are all of good quality, with no cracks/noises. This is my code below.

import bgMusic from "./assets/bgMusic.mp3";
import audio_1 from "./assets/1.mp3";
import audio_2 from "./assets/2.mp3";
import { Audio, Sequence } from "remotion";

export const Bug: React.FC<{}> = () => {
  return (
    <div className="audios">
      <Audio src={bgMusic} volume={0.3} />;
      <Sequence from={15}>
        <Audio src={audio_1} />
      </Sequence>
      <Sequence from={90}>
        <Audio src={audio_2} />
      </Sequence>
    </div>
  );
};
@yuvraj108c yuvraj108c added the bug Something isn't working label Apr 18, 2022
@JonnyBurger
Copy link
Member

Hi @yuvraj108c! Thanks for the report.
I can understand the issue arising due to how FFMPEG works.

To investigate, I need the 3 MP3 files, can you share them as well? If you want, privately under jonny@remotion.dev - I'll take a look at what we can do to improve the mixing in your scenario!

@yuvraj108c
Copy link
Contributor Author

Thanks for replying. I have zipped the 3 audios here: audios.zip

@JonnyBurger
Copy link
Member

Hey Yuvraj,

thanks a lot for uploading! I triggered an investigation and we can confirm the bug. After some trying out, I found a sequence of commands that will generate a better audio than our current mechanism:

ffmpeg -i bgMusic.mp3   -ac 2 -af "[0:a]atrim=0.000:5.000,volume=0.3:eval=once[a0]" out/bgMusic.mp3    -y
ffmpeg -i 1.mp3         -ac 2 -af "[0:a]atrim=0.000:5.000,adelay=500|500|500,atempo=1.00000,apad=whole_dur=5.000,volume=1:eval=once[a0]"  out/1.mp3          -y
ffmpeg -i 2.mp3         -ac 2 -af "[0:a]atrim=0.000:5.000,adelay=3000|3000|3000,atempo=1.00000,apad=whole_dur=5.000,volume=1:eval=once[a0]"       out/2.mp3          -y
ffmpeg -i out/bgMusic.mp3 -i out/1.mp3 -i out/2.mp3 -filter_complex "[0:a][1:a]amerge=inputs=3,pan=stereo|c0<c0+c2+c4|c1<c1+c3+c5[a]" -map "[a]" out/final.mp3        -y

We will refactor our audio pipeline and make it better (also thanks to your report), but we have to prioritize the 3.0 launch that we've been working on for some time now. Sorry for this problem and that we cannot take prompt action to fix it 😌 An alternative for now could be to mix the audio yourself using for example the FFMPEG way showed above.

@yuvraj108c
Copy link
Contributor Author

No worries Jonny, I will use FFMPEG for now until the issue is resolved.

Looking forward for the v3 launch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants