Fade out the main audio track (idea)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.5k
- Forks
- 374
- PR merge metrics
- No merged PRs in 30d
Description
HI,
i tried to set an fade in and fade audio out to the main audio track. Without a smooth fadeout and when the audio track is longer then the generated one, the cut is really hard without a fading.
{
outPath: './firevideo.mp4',
audioFilePath: 'assets/audiot1.aac',
keepSourceAudio:true,
...
It seems that there is no such kind of filter yet. I experiment with ffmpeg and was able to set in and out´s without having the excatly duration of the generated clip.
The filtercomplex i used was:
ffmpeg -i firevideo.mp4 -vcodec copy -filter_complex "aevalsrc=0:d=3.6 [a_silence]; [0:a:0] [a_silence] acrossfade=d=3.6" output.mp4
The value 3.6 fades the audio out at the durationtotal-3.6 seconds.
I would like to add this in audio.js in the filter complex section
async function mixArbitraryAudio({ streams, audioNorm, outputVolume }) {
...
filterComplex += `;${streams.map((s, i) => `[a${i}]`).join('')}amix=inputs=${streams.length}:duration=first:dropout_transition=0:weights=${streams.map((s) => (s.mixVolume != null ? s.mixVolume : 1)).join(' ')}${audioNormArg}${volumeArg}`;
When i insert the ffmpeg synthax i got that the filter can´t implement so many audio tracks. Currently a hot fix is to add this in the index.ts when everything is ready to copy the videotrack and re-encode the main audiotrack.
Is there a way to implement it in the audio.js part?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in audio.js at mixArbitraryAudio and its filter-complex construction, then compare the hot-fix path described in index.ts. Reproduce the supplied ffmpeg command and inspect how the existing audio streams are mixed; done means the main audio track can fade out smoothly when it extends beyond the generated video.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- audio-video-rtc
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100