Gvozden Kuzman
Gvozden Kuzman

Reputation: 74

FFmpeg cutting off exceeded time

Following ffmpeg command is working fine except it cuts down the exceeded -t duration:

ffmpeg -ss 00:00:05 -t 49 -i 1.wav -ss 00:00:05 -t 400 -i 2.wav -ss 00:00:05 -t 49 -i 3.wav -filter_complex "[0:0][1:0][2:0]concat=n=3:v=0:a=1[outa]" -map "[outa]" output.mp3

In this example, 2.wav file is 00:05:09 in length, and we are requesting to get next 400 seconds. Time that exceeded, which is 96 seconds in this example is removed from the output file, and my client doesn't want that.

That extra time should be 96 seconds of silence. Does ffmpeg have such capability or will it always remove the extra time?

Upvotes: 1

Views: 342

Answers (1)

Gyan
Gyan

Reputation: 92928

Use

ffmpeg -ss 00:00:05 -t 49 -i 1.wav -ss 00:00:05 -t 400 -i 2.wav -ss 00:00:05 -t 49 -i 3.wav
 -filter_complex "[1]apad,atrim=0:400[1a];[0][1a][2]concat=n=3:v=0:a=1" output.mp3

The middle file has silent padding added at the end. The trim filter keeps it to 400s duration. The result is then fed to concat.

-t 400 as applied to an input means to read that much data from the input. If that amount doesn't exist then, ffmpeg will read as much as available.

Upvotes: 1

Related Questions