Aleksy Goroszko
Aleksy Goroszko

Reputation: 897

ffmpeg and Youtube upload - can't merge existing audio track with external one

I am realizing campaign, where idea is that users are creating TV ad. The process looks as following:

When realizing audio-video merging I found some suprises:

When I was using command

ffmpeg -i sourceVideoFile.mp4 -i sourceAudioFile.mp3 -acodec copy -vcodec copy outputFile.mp4 - video's music was replaced by user's voice.

So I used option -newaudio:

ffmpeg -i sourceVideoFile.mp4 -i sourceAudioFile.mp3 -acodec copy -vcodec copy outputFile.mp4 -newaudio - I can hear that output video has both music and user's voice. So - that's what I wanted to reach. But...

The surprize is that if I upload this video to Youtube, after it's processing I can watch it and hear only music. User's voice disappears!

So, how to keep both voice and music?

Any idea, gurus? :)

Upvotes: 2

Views: 1053

Answers (1)

Zombo
Zombo

Reputation: 1

This was a fun one.

# Get audio files
ffmpeg -i SVF.mp4 SVF.wav
ffmpeg -i SAF.mp3 SAF.wav

# Merge audio streams
ffmpeg -i SVF.mp4 -f lavfi -i "
amovie=SVF.wav [a0];
amovie=SAF.wav [a1];
[a0][a1] amerge, pan=2:c0=c0+c2:c1=c1+c3" \
-map v -map 1 -c:v copy -c:a libvo_aacenc OF.mp4

Upvotes: 0

Related Questions