FFmpeg 7.1.5
Since* 0.7
#

Damages the contents of packets or simply drops them without damaging the container. Can be used for fuzzing or testing error resilience/concealment.

Parameters:

amount

Accepts an expression whose evaluation per-packet determines how often bytes in that packet will be modified. A value below 0 will result in a variable frequency. Default is 0 which results in no modification. However, if neither amount nor drop is specified, amount will be set to -1. See below for accepted variables.

drop

Accepts an expression evaluated per-packet whose value determines whether that packet is dropped. Evaluation to a positive value results in the packet being dropped. Evaluation to a negative value results in a variable chance of it being dropped, roughly inverse in proportion to the magnitude of the value. Default is 0 which results in no drops. See below for accepted variables.

dropamount

Accepts a non-negative integer, which assigns a variable chance of it being dropped, roughly inverse in proportion to the value. Default is 0 which results in no drops. This option is kept for backwards compatibility and is equivalent to setting drop to a negative value with the same magnitude i.e. dropamount=4 is the same as drop=-4. Ignored if drop is also specified.

Both amount and drop accept expressions containing the following variables:

n

The index of the packet, starting from zero.

tb

The timebase for packet timestamps.

pts

Packet presentation timestamp.

dts

Packet decoding timestamp.

nopts

Constant representing AV_NOPTS_VALUE.

startpts

First non-AV_NOPTS_VALUE PTS seen in the stream.

startdts

First non-AV_NOPTS_VALUE DTS seen in the stream.

durationd

Packet duration, in timebase units.

pos

Packet position in input; may be -1 when unknown or not set.

size

Packet size, in bytes.

key

Whether packet is marked as a keyframe.

state

A pseudo random integer, primarily derived from the content of packet payload.

#

Examples

Apply modification to every byte but don’t drop any packets.

ffmpeg -i INPUT -c copy -bsf noise=1 output.mkv

Drop every video packet not marked as a keyframe after timestamp 30s but do not modify any of the remaining packets.

ffmpeg -i INPUT -c copy -bsf:v noise=drop='gt(t\,30)*not(key)' output.mkv

Drop one second of audio every 10 seconds and add some random noise to the rest.

ffmpeg -i INPUT -c copy -bsf:a noise=amount=-1:drop='between(mod(t\,10)\,9\,10)' output.mkv