Skip to content

Editing and Loudness Check: Assemble Your First Finished Film with FFmpeg ​

One-sentence goal: In this lesson you complete AI short drama editing—concatenating your selected shot clips in shot-list order into a 30–60-second practice finished film, and using loudnorm to unify the volume to the EBU R128 standard.

GUI editing software (such as Jianying or Premiere) can accomplish this lesson's tasks in the same way, but this course has not verified their specific steps; the FFmpeg commands below are authoritative throughout.

What You'll Be Able to Do After This Lesson ​

  • Use trim and atrim to trim each shot to its shot-list duration and reset the timestamps to zero
  • Use the concat filter to join multiple shot clips in shot-list order into one complete timeline
  • Use loudnorm to unify the whole film's volume to the EBU R128 standard (default targets I=-24, LRA=7, TP=-2)
  • Produce a 30–60-second final.mp4 practice finished film with synced audio and video and steady volume

Where You Are Now ​

  • "I've picked all the shots, but they're still a pile of scattered mp4 files—no matter how I look at them, they don't feel like a short drama."
  • "I barely stitched them together, but some shots are loud and some are quiet—it sounds jarring."
  • "I've heard I should use editing software, but the interface is full of buttons—I just want to get the film assembled first."

When to Use This Technique ​

When you need to:

  • Join your selected shot clips in shot-list order into a 30–60-second practice finished film;
  • Unify the whole film's volume so the voiceover no longer jumps between loud and quiet.

And you don't want to:

  • Dive straight into learning GUI editing software interface operations;
  • Manually align every clip on the timeline.

🎒 Preparation Before You Start ​

Core Idea ​

AI short drama editing sounds like a huge undertaking, but the FFmpeg video editing in this lesson really does only three things: trim, join, adjust, each corresponding to one filter:

ActionFilterWhat It Does
Trimtrim / atrim + setpts / asetptsCut off excess head and tail according to the shot-list duration, reset timestamps to zero
JoinconcatConnect multiple segments in order into one timeline; short audio is automatically padded with silence
AdjustloudnormUnify the whole film's loudness per EBU R128

The whole pipeline: shot01.mp4 and other source footage → (trim) shot01_cut.mp4 and other clips → (join) draft.mp4 → (adjust) final.mp4.

Keep two prerequisites in mind: concat requires each segment to start at timestamp 0, so timestamps must be reset to zero after trimming; and the parameters of the corresponding streams in each segment must match—resolution must be explicitly identical, while pixel format and sample rate are unified automatically by concat.

Follow Along ​

Step 1: Trim the Head and Tail of Each Shot ​

Why: The shot list specifies a duration for each shot, and trimming makes clips strictly match the list; concat also requires each segment to start at timestamp 0, so reset to zero right after trimming. trim uses start/end/duration to define the range, and atrim takes the same parameters:

bash
ffmpeg -i shot01.mp4 \
  -vf "trim=start=0:end=4,setpts=PTS-STARTPTS" \
  -af "atrim=start=0:end=4,asetpts=PTS-STARTPTS" \
  shot01_cut.mp4

You should see: shot01_cut.mp4 with a duration of 4 seconds, timestamps starting from 0, and no extra frames at the head or tail.

  • Quick check: run this once for each shot to produce shot01_cut.mp4, shot02_cut.mp4, shot03_cut.mp4

Step 2: Join the Shots and Build the AI Short Drama Editing Timeline ​

Why: FFmpeg joins videos with the concat filter, connecting the trimmed clips in shot-list order into one timeline—once this step is done, a pile of footage truly becomes "a film." It requires the stream parameters of each segment to match (clips generated by the same workflow usually satisfy this naturally); if a segment's audio is shorter than its video, silence is automatically padded:

bash
ffmpeg -i shot01_cut.mp4 -i shot02_cut.mp4 -i shot03_cut.mp4 \
  -filter_complex "[0:v][0:a][1:v][1:a][2:v][2:a]concat=n=3:v=1:a=1[v][a]" \
  -map "[v]" -map "[a]" -c:v libx264 -crf 20 draft.mp4

n=3 is the number of segments to join; if you have more than 3 shots, change it to the actual count and append the -i inputs in order. -map selects the video and audio streams from the concat output; -c:v libx264 works with -crf to control quality—this is the usage from the official documentation example, and the crf value is up to your quality needs.

You should see: draft.mp4 produced, with a total duration approximately equal to the sum of all shots, and playback order matching the shot list.

  • Quick check: play draft.mp4—the order matches the shot list, with no missing or repeated shots

Step 3: Loudness Check and Unification ​

Why: The loudness of the voiceover in different shots may not be consistent, and once joined together it will jump between loud and quiet. loudnorm is FFmpeg's volume normalization filter, which unifies the whole film's loudness per the EBU R128 standard, with default targets I=-24, LRA=7, TP=-2. Note that its dynamic mode internally processes with 192kHz upsampling, so you must specify the sample rate with -ar on output:

bash
ffmpeg -i draft.mp4 -af loudnorm -ar 48000 -c:v copy final.mp4

You should see: final.mp4 with the whole film's loudness up to standard and no more jumps between shots; the video stream is copied directly (-c:v copy), avoiding a second loss of quality.

💡 Volume still fluctuating?

First go back and check the concatenation order for missing or duplicated shots; once confirmed correct, rerun loudnorm.

  • Quick check: ffmpeg -i final.mp4 shows the audio sample rate as 48000, not 192000

Checkpoint ✅ ​

  • Each trimmed clip (shot01_cut.mp4 etc.) starts its timestamps at 0, with durations matching the shot list
  • draft.mp4 Total duration is roughly the sum of all shots, and playback order matches the shot list
  • final.mp4 Duration falls within 30–60 seconds (the course design target for the practice film), containing both a video and an audio stream
  • Play it through once from start to finish: check order, visuals, and volume item by item; if subtitles were burned in, they display correctly

Pitfall Reminders ​

❌ concat reports inconsistent stream parameters ​

Cause: shots with different resolutions were mixed in (e.g., combining landscape and portrait versions). concat automatically unifies parameters like pixel format and sample rate, but resolution is not converted automatically and must be identical across all segments; differing frame rates won't raise an error, but will produce a variable-frame-rate final cut.

Correct approach: go back to the shot stage, unify the parameters, regenerate, then concatenate again.

❌ concat reports a missing audio stream ​

Cause: some shots didn't have the voiceover track merged in, so concatenation reports a missing audio stream.

Correct approach: first complete the audio tracks following the voiceover lesson, then rerun step 2.

❌ Black frames at the start or audio-video misalignment ​

Cause: a segment's timestamps weren't reset to zero after trimming, so concat treated the non-zero start point as the beginning of the segment.

Correct approach: add the setpts/asetpts from step 1, then rerun trimming and concatenation.

❌ Output sample rate as high as 192kHz ​

Cause: loudnorm's internal upsampling in dynamic mode was written into the file.

Correct approach: add -ar 48000 and rerun step 3.

Lesson Summary ​

  • ✅ Use trim/atrim with setpts/asetpts to trim each shot to its shot-list duration and reset timestamps to zero
  • ✅ Use concat to concatenate shots in shot-list order, assembling the AI short drama editing timeline and producing draft.mp4
  • ✅ Use loudnorm for EBU R128 loudness normalization, and -ar 48000 to lock the output sample rate, producing final.mp4

Key parameters recap:

ParameterRecommended valueDescription
trim/atrim's start/endPer the shot-list durationMarks the retention range for each shot
concat's nNumber of shotsNumber of segments to concatenate, corresponding to the number of input files
loudnorm target I-24 (default)EBU R128 integrated loudness target
loudnorm target LRA7 (default)Loudness range target
loudnorm target TP-2 (default)True peak ceiling
-ar48000Prevents loudnorm's internal 192kHz upsampling from being written into the file
-c:v / -crflibx264 / 20Official example usage; set crf to your own quality needs

Next Lesson Preview ​

With the final cut in hand, you still need to check it against platform specifications before publishing: continue with "Export and Pre-Publish Checks: Against YouTube's Official Specifications".

You will learn:

  • YouTube's officially recommended upload encoding settings: container MP4, video H.264, audio AAC-LC 48kHz
  • How to check recommended values for frame rate, resolution, bitrate, and more
  • How to go through the final pre-publish checklist
gaodong.aiAboutPrivacyContact

Independent tutorials, not affiliated with any product mentioned. Product names and trademarks belong to their owners. Check official pages for prices and policies.