[libav-bugs] [Bug 397] Audio padding

bugzilla-daemon at aruru.libav.org bugzilla-daemon at aruru.libav.org
Mon Nov 26 10:49:40 CET 2012


http://bugzilla.libav.org/show_bug.cgi?id=397

--- Comment #2 from Maurizio De Santis <desantis.maurizio at gmail.com> 2012-11-26 10:49:40 CET ---
The functionality is similar to sox pad (http://sox.sourceforge.net/sox.html),
that is add silence at the beginning, end, or a specific position of an audio
stream/file. I was thinking at something like this:

-filter:a[:stream_index] "pad=pp:pd"

where 'pp' stays for 'padding position', and 'pd' for padding duration'. The
position is where you want the padding begins, and should be a time >= 0; the
padding duration is how long is the pad, and should be a time. The sign of the
padding duration influences the calculation of the position: if it is positive
the position is relative to the beginning of the stream, if negative to the
end. It should be possible to add more pads, so you can add a padding at the
beginning and at the end of a stream with one command.

Examples:

# Adds a padding of 10 seconds at the beginning of the stream:
avconv -i input.wav -filter:a "pad=0:10" output.wav

# Adds a padding of 10 seconds at the end of the stream:
avconv -i input.wav -filter:a "pad=0:-10" output.wav

# Adds a padding of 10 seconds at the second 20 counting from the beginning of
the stream:
avconv -i input.wav -filter:a "pad=20:10" output.wav

# Adds a padding of 10 seconds at the second 20 counting from the end of the
stream:
avconv -i input.wav -filter:a "pad=20:-10" output.wav

# Adds a padding of 10 seconds at the beginnning of the stream and a padding of
15 seconds at the end:
avconv -i input.wav -filter:a "pad=0:10;pad=0:-15" output.wav

Honestly, I don't like the fact that the sign of pd influences the way pp is
calculated; at first I was thinking using the sign of pd, but there is a
problem when you want to specify a padding which begins from the end of the
stream:

-filter:a "pad=-0:10"

and there is ambiguity due to the fact that in math -0 is equal to 0. I was
thinking that -0 could be treated like a special case by the options parser,
but than I guess it does not let you to use avconv filters expressions in order
to set the padding starting from the end.

Another option is something like this (similar to sox):

-filter:a "pad=brp:brd:erp:erd"

where they stay respectively for 'beginning relative position', 'beginning
relative duration', 'end relative position', 'end relative duration'. In this
way there is no ambiguity anymore, it is clearer, but it is more verbose. Some
examples:

# Adds a padding of 10 seconds at the beginning of the stream:
avconv -i input.wav -filter:a "pad=0:10:0:0" output.wav

# Adds a padding of 10 seconds at the end of the stream:
avconv -i input.wav -filter:a "pad=0:0:0:10" output.wav

# Adds a padding of 10 seconds at the beginnning of the stream and a padding of
15 seconds at the end:
avconv -i input.wav -filter:a "pad=0:10:0:15" output.wav

-- 
Configure bugmail: http://bugzilla.libav.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the libav-bugs mailing list