site/docs/red-team/strategies/video.md
The Video strategy converts prompt text into a video with text overlay and then encodes that video as a base64 string. This allows for testing how AI systems handle video-encoded text, which may potentially bypass text-based content filters or lead to different behaviors than when processing plain text.
This strategy helps security researchers and AI developers:
The strategy performs the following operations:
The resulting test case contains the same semantic content as the original but in a different format that may be processed differently by AI systems.
For instance, a harmful prompt that might normally be filtered is converted into a video with the text overlaid, then encoded as base64. The encoded video would start like:
AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAu1tZGF0...
Use it in your promptfooconfig.yaml like this:
# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
description: 'Multi-modal redteam'
targets:
- bedrock:amazon.nova-lite-v1:0
prompts:
- file://path/to/your/prompt.json
redteam:
plugins:
- ...
strategies:
- video
- id: basic
config:
enabled: false
:::note
You should only disable all other strategies when using the video strategy. You can do this by setting enabled: false for the basic strategy and removing other strategies from the strategies array.
:::
Your prompt.json file should look like this:
[
{
"role": "system",
"content": "You are a helpful assistant"
},
{
"role": "user",
"content": [
{
"video": {
"format": "mp4",
"source": { "bytes": "{{video}}" }
}
}
]
}
]
:::note You should update the prompt.json to match the prompt format of your LLM provider. Base64 videos are encoded as MP4 format. :::
:::note
The {{video}} syntax in the examples is a Nunjucks template variable. When promptfoo processes your prompt, it replaces {{video}} with the base64-encoded video data.
:::
This strategy requires FFmpeg to be installed on your system:
On macOS:
brew install ffmpeg
On Ubuntu/Debian:
apt-get install ffmpeg
On Windows: Download from ffmpeg.org or use package managers like Chocolatey:
choco install ffmpeg
:::warning This strategy requires more processing resources than other encoding strategies due to video generation. It may take longer to run, especially on large test sets. :::
This strategy is worth implementing because:
For a comprehensive overview of LLM vulnerabilities and red teaming strategies, visit our Types of LLM Vulnerabilities page.