How to Send Patches to FFmpeg Using Git Send-Email

Contributing to the FFmpeg project requires submitting your code changes as patches to their public development mailing list. This guide provides a clear, step-by-step walkthrough on how to configure Git, format your local commits into clean patches, and successfully transmit them to the FFmpeg team using the git send-email tool.

Step 1: Configure Git for Sending Emails

Before you can send patches, you must configure Git with your name, email, and SMTP server details. Open your terminal and edit your global Git configuration or add these lines to your ~/.gitconfig file:

[user]
    name = Your Real Name
    email = your.email@example.com

[sendemail]
    smtpserver = smtp.example.com
    smtpuser = your.email@example.com
    smtpencryption = tls
    smtpserverport = 587

Note: If your email provider requires an app-specific password (like Gmail), use that password when prompted by Git during the sending process.

Step 2: Prepare Your Commit

FFmpeg has strict guidelines for commit messages. Ensure your local commit conforms to their standards:

  1. Prefix the subject line with the component you modified (e.g., avcodec/aacdec: fix memory leak).
  2. Keep the first line short (under 60 characters) and written in the imperative mood.
  3. Provide a detailed description in the body, explaining why the change is necessary.

Commit your changes locally:

git commit -am "avformat/utils: fix typo in duration calculation"

Step 3: Format the Patch

Use git format-patch to convert your local commit into a .patch file.

To generate a patch for the most recent commit on your current branch, run:

git format-patch -1

To format a series of commits (for example, the last 3 commits) and number them, run:

git format-patch -3 --cover-letter

The --cover-letter option generates an additional template file (0000-cover-letter.patch) where you can explain the overall goal of your patch series.

Step 4: Send the Patch to FFmpeg

FFmpeg reviews all incoming patches on the ffmpeg-devel mailing list. Send your generated patch file directly to this list using git send-email:

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

If you are sending a multi-patch series, pass the cover letter first followed by the patches:

git send-email --to=ffmpeg-devel@ffmpeg.org 0000-cover-letter.patch 0001-first.patch 0002-second.patch

Git will prompt you for your SMTP password and then transmit the emails. Once sent, your patch will appear on the FFmpeg development mailing list for review.