How to Send FFmpeg Patches with Git Send-Email

This guide explains how to prepare, format, and submit code contributions to the FFmpeg project using Git. You will learn how to configure your local environment for email delivery, structure your commits according to project conventions, format patches using git format-patch, and transmit them directly to the FFmpeg development mailing list via git send-email.

1. Install and Configure Git Send-Email

First, ensure the git-email package is installed on your system.

On Debian/Ubuntu:

sudo apt install git-email

On Fedora:

sudo dnf install git-email

Configure your global Git identity to match the identity you want associated with your FFmpeg contribution:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

Configure your SMTP settings in your global Git configuration (~/.gitconfig):

[sendemail]
    smtpServer = smtp.example.com
    smtpServerPort = 587
    smtpEncryption = tls
    smtpUser = your.email@example.com

2. Prepare Your Commit

FFmpeg requires clean, self-contained commits with clear commit messages. The message title should specify the affected component followed by a concise summary.

Example commit message:

avcodec/vp9: fix memory leak in decoding context

Fixes an unreleased memory buffer when parsing invalid frames.

Commit your changes locally:

git add path/to/file.c
git commit -m "avcodec/vp9: fix memory leak in decoding context"

3. Generate the Patch

Generate the patch file targeting the current upstream master branch:

git format-patch master

This generates a file named like 0001-avcodec-vp9-fix-memory-leak-in-decoding-context.patch.

If you are updating a previously submitted patch (for example, revision 2), add the -v flag:

git format-patch -v2 master

4. Verify and Test Send

Always test your email configuration by sending the patch to yourself first, or by using the dry-run flag to ensure there are no syntax errors or authentication failures:

git send-email --dry-run 0001-*.patch

To test actual email delivery to your own address:

git send-email --to=your.email@example.com 0001-*.patch

5. Send to the FFmpeg Mailing List

Once verified, send the patch to the official development mailing list (ffmpeg-devel@ffmpeg.org):

git send-email --to=ffmpeg-devel@ffmpeg.org 0001-*.patch

Git will prompt for your SMTP password and confirm the recipients before transmitting the patch. You can monitor the patch status and reviewer feedback via the FFmpeg-devel mailing list archives.