[FFmpeg-user] Mix a video with an audio file

Michael Koch astroelectronic at t-online.de
Sun Jan 19 22:40:25 EET 2020

Am 19.01.2020 um 21:01 schrieb Paul B Mahol:
> On 1/19/20, Michael Koch <astroelectronic at t-online.de> wrote:
>> Hello,
>> I've just found a problem that can be reproduced as follows:
>> Step 1: Make a 6 seconds test video with 1kHz tone. The file is ok when
>> played.
>> ffmpeg -f lavfi -i testsrc2=size=vga -f lavfi -i sine=1000 -t 6 -y video.mp4
>> Step 2: Make a 10 seconds audio file with silence and a short 3kHz tone
>> at t=3s. The file is ok when played.
>> ffmpeg -f lavfi -i "sine=3000:duration=0.1" -af adelay=3000,apad -t 10
>> -y audio.wav
>> Step 3: Combine both files into one video, and the audio sources shall
>> be mixed:
>> ffmpeg -i video.mp4 -i audio.wav -filter_complex
>> "[0:a][1:a]amix=weights='1.0 1.0'" -shortest -y out.mp4
>> The output video has the correct length 6s, but I don't understand why
>> the 1kHz tone disappears after 4s and the last 2s are silence.
>> The console output is below.
> Can not reproduce using nut container.

When I change the output filename to out.nut, then it works as expected 
(but with terrible image quality). Why doesn't it work with mp4 output?


More information about the ffmpeg-user mailing list