While using Handbrake software, what's the best settings to compress the size of the video as much as possible but to leave the vid more or less whatchable
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Below is a step‑by‑step cheat‑sheet that shows the HandBrake settings that give you the smallest file while staying “watchable” for most people.
I’ll explain why each choice matters, give a quick‑reference table, and note the trade‑offs so you can tweak them for your own source material.
1. The Big Picture – What “watchable” really means
Goal
What it translates to in HandBrake
Keep the picture recognisable
Use a modern codec (HEVC/H.265 or AV1) and a reasonable quality factor (CRF/RF).
Avoid blocky artefacts on fast motion
Keep the max bitrate or quality‑limit high enough for scenes with a lot of motion.
Preserve audio intelligibility
AAC/Opus at 96‑160 kbps is fine for most speech/music; you can drop it lower if you really need space.
Play on most devices
H.264 (AVC) is the safest fallback; H.265 works on almost everything made in the last ~5 years, and AV1 is future‑proof if you’re targeting only modern browsers/phones.
Fast encode vs. best compression
Use hardware‑accelerated encoders (NVENC, QuickSync, Apple VideoToolbox) for speed, or the pure‑software x264/x265 encoders for the absolute smallest size.
Universally supported; works with H.264, H.265, and AV1.
Video Codec
H.265 (x265) – orAV1 (libaom‑av1) if you have time
Same visual quality at ~50 % of the bitrate of H.264.
Encoder Preset
slow (or medium if you need faster)
Slower presets spend more time analysing the picture → better compression.
Constant Quality (RF/CRF)
22‑24 (lower = better)
Gives a good “watchable” quality for 1080p/720p. 22 is a sweet spot; 24 is still decent for most content, especially if you’re willing to accept a tiny loss in fine detail.
Copy the JSON into HandBrake → Presets → Import → From File (or just type the settings manually).
3. Why These Numbers Work
3.1. Codec Choice – H.265 vs. H.264 vs. AV1
Codec
Typical size reduction vs. H.264
Encode speed (software)
Device support
H.264 (x264)
Baseline (no reduction)
Fast
Everyone
H.265 (x265)
~45‑55 % smaller for same quality
Moderate‑slow (slow preset ≈ 3‑5 × x264)
2015‑+ devices, most browsers with MP4
AV1 (libaom‑av1)
~55‑65 % smaller vs. H.264
Very slow (10‑30 × x264)
Modern browsers, Android 12+, iOS 14+ (via Safari)
If you have time (or a powerful CPU/GPU) and you’re willing to wait a few hours for a 2‑hour movie, AV1 is the ultimate size‑saver. Otherwise, H.265 is the sweet spot.
3.2. Constant Quality (RF/CRF) Explained
RF 18–20 → Near‑source quality, file size still ~30‑40 % of the original (good for archiving).
RF 22–24 → “Good enough for everyday watching”. Most users can’t tell the difference from the source unless they look side‑by‑side.
RF 26+ → Noticeable artefacts, especially in fast‑moving scenes or low‑light footage.
3.3. Resolution Scaling
1080p → 720p cuts the pixel count from 2 073 600 to 921 600 (≈ 55 % reduction).
If the source is already 720p or lower, don’t downscale – you’ll just waste quality.
3.4. Audio
Speech‑heavy videos (talk shows, tutorials) can go as low as 96 kbps with negligible loss.
Music‑heavy content (concerts, movies with rich soundtrack) benefits from 128 kbps or 160 kbps.
4. How to Build a “Size‑Targeted” Encode (optional)
If you must stay under a strict size limit (e.g., 700 MB for a USB stick), you can combine CRF with a max‑bitrate or use the “Average Bitrate (ABR)” mode:
Tick “2‑Pass” (optional, gives a slightly tighter size).
Keep CRF at 22 as a quality floor (HandBrake will never go below that quality even if the bitrate ceiling is hit).
5. Quick “One‑Click” Workflow (for most users)
Open HandBrake → Source → “File” → pick your video.
In the Presets pane, click “Fast 720p30” (or “Fast 1080p30” if you don’t want to downscale).
Click “Video” tab:
Change Codec to H.265 (x265).
Set Quality to 22 (or 24 for even smaller).
Set Encoder Preset to slow (or medium if you’re in a hurry).
Filters: leave everything off unless you need deinterlacing.
Audio: choose AAC, 128 kbps, Stereo.
Dimensions: if you started from a 1080p source, type 1280 in the Width box and 720 in the Height box (or click “Anamorphic → None → 720p”).
Save As → give it a name → Start Encode.
You’ll get a file roughly 30‑45 % the size of the original while still looking fine on a phone, tablet, or laptop screen.
6. Testing & Fine‑Tuning
Encode a 1‑minute clip first.
Play it back on the device you intend to use (phone, TV, browser).
Look for:
Blocky macro‑blocks in fast motion → lower RF (e.g., 21).
Banding or posterisation in gradients → raise RF (e.g., 24) and/or increase max bitrate.
Audio hiss → bump audio bitrate to 160 kbps.
If the test looks good, encode the full file with the same settings.
7. Bonus: When to Use Hardware Encoders
Situation
Recommended HW Encoder
Settings
You need a fast encode (≤ 30 min for a 2‑hour movie)
NVENC (HEVC) on an Nvidia GPU or Intel QuickSync (HEVC)
RF = 26‑28, preset “medium”, keep same resolution.
You have an Apple Silicon Mac
VideoToolbox (HEVC)
RF = 24‑26, “slow” preset.
You want the absolute smallest file and have time
Software x265 (or AV1)
RF = 22‑24, preset “slow”.
Tip: Even with hardware encoders, you can still set CRF (called “Quality”) – just remember they’re ~5‑10 % less efficient than software, so bump the RF up a notch.
8. TL;DR Cheat‑Sheet (copy‑paste)
Parameter
Value
Notes
Container
MP4
.mp4
Video Codec
H.265 (x265) or AV1 (libaom‑av1)
H.265 is fastest; AV1 is smallest
Encoder Preset
slow (or medium for speed)
Slower = better compression
Constant Quality
RF 22 (1080p) orRF 23‑24 (720p)
Lower = better quality
Resolution
1280 × 720 (if source ≥1080p)
Keep original if ≤720p
Framerate
Same as source (VFR)
No need to drop fps
Filters
None (unless deinterlacing needed)
Audio
AAC LC, 128 kbps, Stereo
96 kbps mono for speech‑only
Subtitles
None (or burn‑in only if needed)
Two‑Pass
Off (use CRF)
Only for strict average‑bitrate targets
Hardware Accel
Off (software) – best size
Turn on only for speed, raise RF a bit
Final Takeaway
Pick H.265, set CRF ≈ 22, downscale to 720p if you’re starting from 1080p, and keep audio at 128 kbps AAC.
This combination typically halves the file size of a typical 1080p H.264 source while still looking perfectly fine on any modern screen.
If you must squeeze even more, move to AV1 or raise the CRF to 24‑26, but test a short clip first—you’ll instantly see the point where “watchable” turns into “unwatchable”.
Happy encoding! 🚀
User
What's the easiest way to merge two different audio trecks in a video file into one?
Assistant
Below is a step‑by‑step recipe (and a few GUI alternatives) that will let you take a video that already contains two separate audio streams (e.g., an English “voice‑over” track and a separate music‑only track) and combine them into a single audio track that is then muxed back into the video.
1️⃣ Quick‑and‑dirty one‑liner with FFmpeg
What it does Extracts the two audio streams, mixes them together, and remuxes the result with the original video (no re‑encoding of the video, optional re‑encoding of the audio).
bash
# Replace these with your actual file names
INPUT="movie_with_two_audios.mkv"
OUTPUT="movie_one_audio.mkv"
# -------------------------------------------------
# 1. Find out the audio stream indexes (optional but handy)
ffprobe -v error -select_streams a -show_entries stream=index,codec_name,channels,language -of csv=p=0 "$INPUT"
# -------------------------------------------------
# 2. Mix the two audio streams (here we assume they are #0:1 and #0:2)
ffmpeg -i "$INPUT" \
-filter_complex "[0:a:0][0:a:1]amix=inputs=2:duration=longest:dropout_transition=2[aout]" \
-map 0:v # copy every video stream as‑is
-map "[aout]" # use the mixed audio as the new audio stream
-c:v copy # do NOT re‑encode video (fast)
-c:a aac -b:a 192k # re‑encode audio to AAC (change if you want another codec)
-metadata:s:a:0 language=eng \
-metadata:s:a:0 title="Mixed audio (eng+music)" \
-y "$OUTPUT"
What each flag means
Flag
Meaning
-i "$INPUT"
Input file
User
How to merge two audio tracks into one using Handbreak?
Assistant
HandBrake 1.6+ – “Mix two audio streams into a single track”
HandBrake can mix (add together) any number of audio streams that are present in the source file and output one combined audio track.
The feature is called “Audio Mixdown” and lives in the Audio tab of the main window.
Note – HandBrake versions earlier than 1.6 (the one that introduced the audio‑mix UI) cannot do this.
If you are on an older build, download the latest release from https://handbrake.fr (or use the command‑line ffmpeg method).
Below is a step‑by‑step guide that works on Windows, macOS, and Linux.
1️⃣ Load your source video
Open HandBrake.
Click “Open Source” → select the video file that contains the two audio tracks (e.g., an English voice‑over + a music‑only track).
HandBrake will scan the file and show a Summary tab with a preview.
2️⃣ Verify that HandBrake sees both audio tracks
Switch to the Audio tab.
You should see a list of the audio streams, e.g.:
#
Codec
Language
Channels
1
AAC
eng
Stereo
2
AAC
eng
Stereo
If you only see one entry, the file really only has one audio track (or the second track is a subtitle or data stream). In that case you’ll need to add the missing track with another tool first.
3️⃣ Add the two tracks to the Mixdown list
HandBrake treats each row in the Audio tab as an output track. To mix the two source tracks:
Click the + button (bottom‑left of the Audio tab) twice – this adds two blank output rows.
(You can also click the “Add Track” button in newer UI versions.)
For Row 1 (the first output track):
Source → choose (the first audio stream of the source).
User
Can I mix two different audio tracks into one using Avidemux?
Assistant
Short answer
Avidemux cannot directly “mix” two audio streams into a single track.
It can only add or replace an audio stream, but it has no built‑in mixer/adder filter.
What you can do is:
Extract the two audio tracks with Avidemux (or any other tool).
Mix them together in a program that can edit audio (Audacity, Adobe Audition, FFmpeg, etc.).
Re‑mux the mixed audio back into the video with Avidemux (or straight‑away with FFmpeg).
Below is a complete, beginner‑friendly workflow that stays mostly inside Avidemux, but uses Audacity (free, cross‑platform) for the actual mixing. I also give a pure‑FFmpeg alternative for those who prefer a command‑line one‑liner.
📚 Why Avidemux alone can’t mix
Feature
Avidemux
Typical mixing tools
Add a second audio track
✅ (Audio → Add track)
—
Replace an existing track
✅ (Audio → Select track)
—
Adjust volume of each track separately
❌ (no per‑track gain control)
Add the two streams together (sample‑by‑sample)
❌ (no “amix”/“amerge” filter)
Export a mixed‑down audio file
❌ (only raw demux)
Re‑encode audio while mixing
❌ (mixing requires decoding first)
Because mixing requires decoding both streams, adjusting their levels, and then adding the samples together, Avidemux simply doesn’t have that capability built‑in. The easiest workaround is to pull the audio out, mix it elsewhere, then put the result back.
🛠️ Full “Extract → Mix → Re‑mux” workflow
1️⃣ Extract the two audio tracks with Avidemux
Open your video in Avidemux (File → Open).
Go to Audio → Select track.
You’ll see a list of audio streams (e.g., Track 1 – English, Track 2 – Music).
For each track you want to extract:
User
I allready installed ffmpeg on my pc, but when I try to use it in cmd it not reccognized. How can I fix that?
Assistant
Why ffmpeg is “not recognized”
When you type
cmd
ffmpeg -version
and Windows (or any shell) replies “‘ffmpeg’ is not recognized as an internal or external command, operable program or batch file.”, the problem is not that ffmpeg is broken – it’s that the shell cannot find the executable file because the folder that contains ffmpeg.exe is not in your system’s PATH environment variable.
Below is a complete, step‑by‑step guide that will:
Verify that you really have a working ffmpeg.exe.
Add the folder to the PATH (both for the current session and permanently).
Test that it works.
Show quick alternatives for Linux/macOS and for “portable” one‑off use.
📁 1. Make sure you really have ffmpeg.exe
Windows (most common case)
Step
What to do
Why
Download the correct build
Go to the official site: https://ffmpeg.org/download.html → “Windows builds by BtbN” (or “Gyan”) → download the ffmpeg‑release‑full.7z (or the zip that contains ffmpeg.exe).
Those builds are pre‑compiled and ready to run.
Extract the archive
Right‑click → Extract All… (or use 7‑Zip) → extract to a folder you can remember, e.g. C:\Program Files\ffmpeg\ or C:\ffmpeg\.
The executable lives in a sub‑folder called bin.
Locate ffmpeg.exe
Open the folder you just extracted and go to …\ffmpeg‑<version>\bin\ffmpeg.exe. Double‑click it – a black console window should flash and then close, indicating the program runs.
If it runs, the binary is fine. If you get a Windows “cannot open the file” error, the download may be corrupted – re‑download.
Tip: Keep the folder structure intact (ffmpeg‑<ver>\bin\ffmpeg.exe). You will point the PATH to the folder, not to the exe itself.
User
Can you explain me this command "ffmpeg -i input.mp4 -filter_complex "[0:a:0][0:a:1]amix=inputs=2:duration=longest:weights=0.5 0.5[a]" -map 0:v -map "[a]" -c:v copy -c:a aac -b:a 192k mixed.mp4"?
Assistant
Below is a line‑by‑line walk‑through of the command you posted, plus the concepts that make each part work.
I’ll also point out the gotchas (quoting, stream indexing, etc.) and show a few useful variations.
Readinput.mp4 (which contains at least two audio streams).
Mix audio stream 0 and audio stream 1 together, giving each stream an equal contribution (50 % each).
Keep the video unchanged (no re‑encoding).
Encode the mixed audio as AAC at 192 kbit/s.
Mux the copied video and the newly‑encoded audio into a new file called mixed.mp4.
The result is a single‑track MP4 that plays the original picture with the two audio tracks summed together.
2️⃣ Detailed breakdown
Piece of the command
What it is
Explanation
ffmpeg
Program
The FFmpeg command‑line tool.
-i input.mp4
Input option
Tells FFmpeg to open input.mp4 as the first (and only) input file. All subsequent stream references (0:) refer to this file.
-filter_complex "...
Complex‑filter option
Starts a filtergraph that can use multiple inputs and produce named outputs. The whole string inside the quotes is the filter description.
[0:a:0][0:a:1]
Filtergraph input pads
0: = first input file (the only one we have). a: = audio stream. 0 and are the of the two audio streams inside that file. → = audio stream 0, = audio stream 1.
Dataset releases
Not yet included in a published release.
-filter_complex "[0:a:0][0:a:1]amix=…[aout]"
Mix the two audio streams (a:0 and a:1). amix adds them sample‑by‑sample. duration=longest keeps the mix as long as the longest source (so you don’t cut off music when the voice‑over ends).
-map 0:v
Keep all video streams (usually just one) unchanged.
-map "[aout]"
Use the mixed audio as the single audio stream for the output.
-c:v copy
Copy video without re‑encoding → lossless and instantaneous.
-c:a aac -b:a 192k
Encode the new audio to AAC at 192 kbps (adjust to 128k, 256k, etc., or use -c:a copy if the source audio is already AAC and you’re happy with the raw mix).
-metadata:s:a:0 …
Optional tags (language, title).
-y
Overwrite the output file if it already exists.
Tweaking the mix
Volume balance – prepend a volume filter to each input: "[0:a:0]volume=1.2[a0];[0:a:1]volume=0.8[a1];[a0][a1]amix=inputs=2…"
Stereo vs. Mono – amix keeps the channel layout of the first input. If you want a mono mix, add pan=mono|c0=c0+c1 after amix:
If the two original audio streams are already in the codec you want (e.g., both AAC) and you just need them summed without any re‑encoding, you can let FFmpeg mix in the raw domain and then copy:
Note: -c:a copy works only if the mixed stream’s format matches the original codec. If the two inputs have different codecs (e.g., AAC + AC3) you must re‑encode to a single codec.
3️⃣ GUI alternatives (no terminal)
Tool
How to do it
Pros
Cons
HandBrake
1. Load video → Audio tab → Select both tracks, then click “Mix” (available in newer builds). 2. Choose output codec (AAC/MP3) → Start Encode.
Very beginner‑friendly, batch capable.
Limited control over volume balance; only works on HandBrake 1.6+ (older builds lack the mix feature).
Avidemux
1. Open file → Audio → Select Track → Add the second track → Audio → Output → Copy (or re‑encode) → Save.
Simple UI, works on Windows/macOS/Linux.
No built‑in gain control; mixing is “add‑together” which may clip if levels are high.
VLC Media Player (transcode)
Media → Convert/Save → Add file → Profile → Edit profile → Audio codec → Keep original audio → Add a second audio track → Start.
Already installed on most machines.
Not as straightforward for mixing; you usually end up with two separate tracks, not a single mixed one.
DaVinci Resolve / Adobe Premiere
Import video → drag to timeline → place each audio track on its own layer → Export → Audio → Mixdown → Render.
Full professional control, visual waveform editing.
Overkill for a simple mix; requires a fairly powerful machine.
Audacity (for audio‑only work)
1. Open video with Audacity (it extracts audio). 2. Import the second track (File → Import → Audio). 3. Align, adjust volume, Export as WAV/MP3. 4. Re‑mux with FFmpeg (-c:v copy -i video -i newaudio).
Precise waveform editing, easy to apply EQ/compression.
Two‑step process (extract → edit → remux).
4️⃣ Full‑workflow example (Windows, macOS, Linux)
Below is a complete, copy‑and‑paste script for a typical “mix voice‑over + background music” job. It assumes:
The video file is source.mkv.
Audio #0 is the voice‑over (English, 2‑channel).
Audio #1 is the music (stereo, maybe louder).
You want the final mix to be AAC 192 kbps stereo, with the voice a little louder than the music.
bash
#!/usr/bin/env bash
# -------------------------------------------------
# 1️⃣ Set variables
INPUT="source.mkv"
OUTPUT="source_mixed.mkv"
# -------------------------------------------------
# 2️⃣ Show the audio streams (helps you find the indexes)
echo "=== Audio streams in $INPUT ==="
ffprobe -v error -select_streams a -show_entries stream=index,codec_name,channels,language -of csv=p=0 "$INPUT"
# -------------------------------------------------
# 3️⃣ Mix with volume adjustment
ffmpeg -i "$INPUT" \
-filter_complex "\
[0:a:0]volume=1.5[a0];\
[0:a:1]volume=0.8[a1];\
[a0][a1]amix=inputs=2:duration=longest:dropout_transition=2[aout]" \
-map 0:v -c:v copy \
-map "[aout]" -c:a aac -b:a 192k \
-metadata:s:a:0 language=eng \
-metadata:s:a:0 title='Mixed (voice+music)' \
-y "$OUTPUT"
echo "✅ Done! Mixed file saved as $OUTPUT"
Save the script as mix.sh, give it execute permission (chmod +x mix.sh), and run it.
On Windows you can copy the same command line into a .bat file, just replace the line‑breaks with ^ or put the whole filter in one line.
5️⃣ Common pitfalls & how to fix them
Problem
Why it happens
Fix
Clipping / distortion
The two tracks together exceed the 0 dB limit.
Reduce the volume of one or both inputs (volume=0.7), or add a limiter after amix: ,dynaudnorm=f=150 or ,acompressor
Audio out of sync
One track starts later than the other (e.g., music has a 500 ms lead).
Use `adelay=500
Result is mono when you wanted stereo
The first input was mono, and amix inherits its channel layout.
Use pan after amix to force stereo, or use amerge instead of amix.
Output file is huge
You accidentally copied the original uncompressed audio (e.g., PCM).
Explicitly set an audio codec (-c:a aac -b:a 192k) or -c:a libopus -b:a 128k.
Two audio tracks still appear in the output
You didn’t map the mixed stream exclusively, or you used -c:a copy on a source that already contained two tracks.
Use -map "[aout]"and-map 0:v only; do not use -map 0:a.
FFmpeg says “Invalid argument for filter ‘amix’”
Wrong syntax for the filter (usually missing quotes or misplaced brackets).
Keep the whole filter inside a single pair of double quotes ("), and escape inner quotes if you’re on Windows (\").
6️⃣ Bonus: Batch‑process an entire folder
If you have dozens of videos that all contain the same two audio tracks, you can loop over them:
Change 0:a:0 / 0:a:1 if your audio indexes differ (run ffprobe to verify).
Adjust -b:a or add volume= filters to suit your loudness preferences.
🎉 You’re ready!
Check the stream indexes (ffprobe).
Mix with amix (or amerge if you need separate channels).
Copy the video, re‑encode the audio to the codec you want.
Enjoy a single, perfectly synchronized audio track that you can ship, upload, or archive.
If you hit any snags, drop the exact error message here and I’ll help you troubleshoot! Happy mixing. 🚀
“Track 1”
Codec → pick the codec you want for the final file (AAC, MP3, Opus, AC3, etc.).
Mixdown → keep the default (usually “Stereo” or “5.1” depending on the source).
Gain → optional; you can boost or cut the level of this track (e.g., +3 dB for voice).
For Row 2 (the second output track):
Source → choose “Track 2” (the second audio stream of the source).
Codec → must be the SAME codec as Row 1 (HandBrake will refuse to mix tracks with different codecs).
Mixdown → same as Row 1.
Gain → optional; lower the music level if you want the voice to dominate (-2 dB, for example).
Important – Do NOT leave any other rows empty; HandBrake will only output the rows you have configured.
At this point the Audio tab will look something like this (example for AAC, 192 kbps):
code
# Source Codec Mixdown Bitrate Gain DRC Name
1 Track 1 AAC Stereo 192 kbps +3 dB Voice+Music
2 Track 2 AAC Stereo 192 kbps -2 dB Voice+Music
4️⃣ Enable Mixdown (the actual mixing)
Still in the Audio tab, look at the bottom of the window for the checkbox “Mixdown all selected audio tracks into a single track” (the exact wording may vary by platform, but it’s a single‑checkbox).
In HandBrake 1.6 the checkbox reads “Mixdown all audio tracks”.
In later builds (1.7‑1.8) it appears as “Mix all selected audio tracks into one”.
Check that box.
When the box is checked, HandBrake will add the two rows together and output one audio track (the codec/bitrate settings you chose for the rows will be applied to the mixed track).
(Optional) Set a Track Name in the “Name” column – e.g., “English (voice + music)”. This name is written into the output file’s metadata and is what players will display.
5️⃣ Choose the rest of your encode settings
Video tab: keep your preferred video codec/preset/CRF. You can even set “Video → Codec → Copy” if you don’t need to re‑encode video.
Dimensions tab: set any scaling you want (e.g., down‑scale to 720p).
Audio tab (already configured): you can also set “DRC” (dynamic range compression) if you want to tame loud peaks.
Filters, Subtitles, etc.: configure as needed.
6️⃣ Start the encode
Choose an output destination (bottom‑right “Save As” field).
Click “Start Encode” (or “Queue → Add to Queue → Start Queue” if you have multiple files).
HandBrake now does three things:
Demuxes the two source audio streams.
Applies the per‑track gain you set.
Adds the two streams together sample‑by‑sample (the internal amix filter).
Encodes the mixed audio with the codec/bitrate you chose.
Muxes the single mixed audio back together with the video.
When the job finishes, open the output file in any media player (VLC, MPV, etc.) → Audio → Track → you should see only one audio track, containing both voice and music.
7️⃣ Quick sanity‑check (optional)
If you want to make sure the mix is really there, you can inspect the file with ffprobe (or HandBrake’s own Preview → Audio view):
The “Mixdown all selected audio tracks” checkbox is greyed out
You have different codecs selected for the two rows (e.g., AAC + MP3) or you left one row empty.
Make both rows use the same codec and set a bitrate for each.
Output file still has two audio tracks
The checkbox was not checked, or you added a third empty row that HandBrake treats as a separate track.
Re‑open the file, verify only the two rows you filled are present, and ensure the checkbox is ticked.
Clipping / distortion
The two tracks together exceed 0 dB, especially if both are loud.
Use the Gain column to lower one or both tracks (e.g., –3 dB on the music). You can also enable DRC (dynamic range compression) to tame peaks.
Audio is mono after mixing
The first source track you selected is mono; HandBrake inherits the channel layout of the first input.
Either (a) make the first track stereo (if possible) or (b) after mixing, set Mixdown to “Stereo” and add a Gain of 0 dB – HandBrake will up‑mix the mono source to stereo.
HandBrake refuses to start
The source file contains more than two audio tracks and you only selected two; HandBrake may try to mix all tracks by default.
In the Audio tab, un‑check any rows you don’t want to be part of the mix, or delete extra rows with the – button.
9️⃣ Summary cheat‑sheet (one‑screen view)
Step
Action
Setting
1
Open Source → select video
—
2
Audio tab → Add Track twice
—
3
Row 1 → Source = Track 1, Codec = AAC, Bitrate = 192 k, Gain = +3 dB
(adjust as you like)
4
Row 2 → Source = Track 2, Codec = AAC, Bitrate = 192 k, Gain = –2 dB
same codec as Row 1
5
Check “Mixdown all selected audio tracks into a single track”
—
6
Set Video options (CRF, preset, etc.)
—
7
Start Encode
—
8
Verify output has one audio track
—
10️⃣ If you can’t upgrade HandBrake (or need more control)
HandBrake’s built‑in mix is simple (just adds the streams). For finer control (e.g., per‑track compression, side‑chain ducking, exact dB‑level balancing) you’ll need an external tool such as ffmpeg:
But for the majority of “voice‑over + background music” jobs, HandBrake’s UI mix is quick, reliable, and fully GUI‑driven.
🎉 You’re done!
Just open the newly‑created file, play it, and enjoy a single, clean audio track that contains both original sources. If you run into any specific error messages, drop them here and I’ll help you troubleshoot. Happy encoding!
Choose the track.
Click “Save” (or “Save audio” depending on your version).
Choose a file name like voice.wav for the first track, music.wav for the second.
Important: Select “WAV (PCM)” as the output format if you plan to edit in Audacity – this avoids any extra compression steps.
Repeat for the second track.
After this you have two separate audio files on disk.
Tip: If Avidemux only offers “Copy” (no re‑encode) you can still save as .wav by first selecting “Audio → Codec → PCM (uncompressed)” and then saving. The video itself stays untouched; you’re just extracting audio.
2️⃣ Mix the two audio files in Audacity (free, GUI)
Audacity will place each file on its own track (they appear as separate rows).
Adjust relative volumes (optional):
Click the Gain slider on the left of the voice track and raise it a bit (e.g., +3 dB).
Lower the music track if it drowns the voice (e.g., -6 dB).
You can also apply effects → Effect → Compressor or Effect → Normalize if you need to tame peaks.
Make sure the two tracks are perfectly aligned (start at the same time). If one starts later, click the Time Shift Tool (↔) and drag it so both start at 0 seconds.
When you’re happy with the balance, go to File → Export → Export as WAV (or MP3/OGG if you prefer a compressed format).
Name it mixed.wav (or mixed.m4a if you want AAC).
Choose 16‑bit PCM WAV for lossless safety; you can later let Avidemux re‑encode to AAC/MP3 if you want a smaller file.
3️⃣ Put the mixed audio back into the video with Avidemux
Re‑open the original video in Avidemux (File → Open).
In the Video tab, set Video → Copy (or keep whatever codec you need).
Click “Add track” → browse to mixed.wav (or mixed.m4a).
Set Codec to the format you want for the final file (e.g., AAC (Faac), MP3 (LAME), AC3, or PCM if you want lossless).
Adjust Bitrate if you’re using a lossy codec (e.g., 192 kbps AAC).
Save (File → Save → Save Video…) and pick an output container (MP4, MKV, etc.). Avidemux will now mux the single mixed audio track together with the unchanged video.
You end up with a video that has one audio stream containing the combined voice + music.
⚡ One‑liner alternative (no Audacity) – pure FFmpeg
If you don’t mind a tiny command‑line step, you can skip Audacity entirely:
bash
# 1. Extract both audio streams (optional, just for reference)
ffprobe -v error -select_streams a -show_entries stream=index,codec_name,channels,language -of csv=p=0 input.mkv
# 2. Mix them and re‑mux in a single command
ffmpeg -i input.mkv \
-filter_complex "[0:a:0]volume=1.5[a0];[0:a:1]volume=0.8[a1];[a0][a1]amix=inputs=2:duration=longest[aout]" \
-map 0:v -c:v copy \
-map "[aout]" -c:a aac -b:a 192k \
-metadata:s:a:0 title="Voice+Music" \
-y output.mkv
Replace 0:a:0 and 0:a:1 with the actual stream indexes you saw from ffprobe.
Adjust the volume= values to balance the tracks (1.0 = 0 dB, 1.5 ≈ +3.5 dB, 0.8 ≈ –2 dB).
amix adds the two streams together; duration=longest keeps the mix as long as the longest source.
This command does not re‑encode the video (-c:v copy) and only re‑encodes the audio once, producing a file that is ready to use.
📋 Quick checklist
✅
What you need
✅ Avidemux (installed)
To extract audio and re‑mux the final mix.
✅ Audacity (or any audio editor)
To actually blend the two tracks.
✅ FFmpeg (optional)
If you prefer a single‑command solution.
✅ Source video with at least two distinct audio streams.
🔧 Troubleshooting tips
Symptom
Likely cause
Fix
Only one audio track appears after re‑mux (but you expected two)
You didn’t check the “Add track” box or you removed the original track.
In the Audio tab, click Add track, browse to the mixed file, then set the codec.
Audio is too loud / distorted
The two tracks added together exceed 0 dB.
Lower the Gain values in Audacity or the volume= filters in the FFmpeg command.
Music is out of sync
The two source tracks had different start times.
In Audacity, use the Time Shift Tool to align them, or in FFmpeg use adelay= on the delayed track (`[0:a:1]adelay=500
Output file is huge
You kept the mixed audio as uncompressed PCM.
When you re‑add the track in Avidemux, choose a compressed codec (AAC, MP3, Opus) and set a reasonable bitrate (e.g., 128‑192 kbps AAC).
Avidemux refuses to open the mixed file
The mixed file is in a format Avidemux doesn’t support (e.g., OGG).
Export the mixed audio as WAV (or AAC/MP3) before importing.
📦 TL;DR – One‑page recipe
Open video in Avidemux → Audio → Select track → Save each track as voice.wav and music.wav.
Open Audacity → Import both WAVs → Align → Adjust gains → Export as mixed.wav.
Video → Copy (or keep your desired video settings).
File → Save → output.mp4 (or .mkv).
Result: a single audio track that contains the combined voice and music, ready for playback on any device.
If you’re comfortable with a command line, the FFmpeg one‑liner does the whole job in ~1 second per minute of video, no Audacity needed.
Happy mixing! 🎧 If you run into a specific snag (e.g., “Avidemux says Unsupported audio format”), drop the exact error message and I’ll walk you through the fix.
bin
🛠️ 2. Add the folder to the PATH
You have three ways to make ffmpeg visible to cmd:
Method
Scope
When to use
Temporary (session‑only)
Only the current command window
Quick test, no admin rights needed
Permanent – User‑level
Only your Windows user account
No admin rights needed, safe for shared PCs
Permanent – System‑level
All users on the computer
Requires admin rights, good for workstations
2A️⃣ Temporary (session‑only)
Open a new Command Prompt and type:
cmd
set PATH=%PATH%;C:\ffmpeg\bin
ffmpeg -version
Replace C:\ffmpeg\bin with the actual path where ffmpeg.exe lives.
If the version information prints, the temporary fix works. When you close that window the change disappears.
2B️⃣ Permanent – User‑level (recommended for most people)
Or right‑click This PC → Properties → Advanced system settings → Environment Variables.
Under “User variables for <your‑name>” look for a variable named Path.
If it exists, select it and click Edit….
If it does not exist, click New…, name it Path, and click Edit….
Add a new entry
Click New and paste the full path to the bin folder, e.g. C:\ffmpeg\bin.
Click OK on all dialogs.
Close and reopen any Command Prompt (or PowerShell) windows.
Test:
cmd
ffmpeg -version
You should see the version banner.
2C️⃣ Permanent – System‑level (admin)
Same steps as 2B, but edit the “System variables” section instead of the user section. You need to be an administrator (or run the UI as admin). The rest is identical.
✅ 3. Verify the installation
Open a fresh Command Prompt (or PowerShell) and run:
cmd
ffmpeg -hide_banner -version
You should see something like:
code
ffmpeg version 7.0.2-static ...
built with gcc ...
configuration: ...
...
If you see that, you’re all set.
🐧 4. If you’re on Linux or macOS
OS
Quick install command
Verify
Ubuntu / Debian
sudo apt update && sudo apt install ffmpeg
ffmpeg -version
Fedora
sudo dnf install ffmpeg
ffmpeg -version
Arch / Manjaro
sudo pacman -S ffmpeg
ffmpeg -version
macOS (Homebrew)
brew install ffmpeg
ffmpeg -version
macOS (MacPorts)
sudo port install ffmpeg
ffmpeg -version
These package managers automatically place ffmpeg in a directory that is already on the PATH (/usr/local/bin, /opt/homebrew/bin, etc.).
🛡️ 5. Common pitfalls & how to fix them
Symptom
Likely cause
Fix
“The system cannot find the path specified” when you edit Path
You typed the path incorrectly or included a trailing quote.
Double‑check the exact folder path. Use the Browse… button in the Edit environment variable dialog to avoid typos.
ffmpeg still not found after adding to Path
You edited the SystemPath but are running a Command Prompt opened before the change.
Close all cmd/PowerShell windows and open a new one.
Multiple ffmpeg.exe copies on the system
An old copy is earlier in the Path and is broken.
Run where ffmpeg (cmd) or Get-Command ffmpeg (PowerShell) to see which exe is being called. Remove or reorder the unwanted entry.
Windows shows “Access is denied” when you double‑click ffmpeg.exe
The file is blocked (downloaded from the internet).
Right‑click ffmpeg.exe → Properties → click Unblock → OK.
You get “The system cannot find the file specified” when you run ffmpeg
The bin folder is not actually on the Path (maybe you added the parent folder).
The Path entry must end with \bin (e.g., C:\ffmpeg\bin).
ffmpeg works in PowerShell but not in CMD
PowerShell may have its own $Env:Path that you edited, while CMD still uses the old value.
Edit the system or userPath via the UI (covers both shells).
📂 6. Optional: Keep a “portable” copy without touching PATH
If you don’t want to modify environment variables (e.g., on a locked‑down work PC), you can run ffmpeg by giving the full path each time:
Or, create a tiny batch file ff.bat placed in a folder that is on the PATH (e.g., C:\Windows\System32 if you have admin rights):
bat
@echo off
"C:\ffmpeg\bin\ffmpeg.exe" %*
Now you can type ff -i … anywhere and it will forward all arguments to the real ffmpeg.exe.
📚 Quick cheat‑sheet (copy‑paste)
Windows – add to user PATH
cmd
:: 1️⃣ Create the folder (if you haven’t already)
mkdir C:\ffmpeg
:: 2️⃣ Extract the zip you downloaded into C:\ffmpeg
:: 3️⃣ Add the bin folder to the user PATH (run in PowerShell as your normal user)
[Environment]::SetEnvironmentVariable(
"Path",
[Environment]::GetEnvironmentVariable("Path","User") + ";C:\ffmpeg\bin",
"User")
:: 4️⃣ Close and reopen cmd, then test
ffmpeg -version
(The PowerShell line does the same thing the GUI does – it appends the path to the current user’s Path variable.)
If you ever need to remove the entry later, just go back to the Environment Variables window, edit the Path, select the C:\ffmpeg\bin line, and click Delete.
Happy encoding! If you run into any specific error message while adding the path or running ffmpeg, paste the exact text here and I’ll help you troubleshoot further.
1
indices
First pad
second pad
amix=inputs=2:duration=longest:weights=0.5 0.5
amix filter with parameters
amix = “audio mix”. It adds the supplied audio streams sample‑by‑sample.Parameters:• inputs=2 – we are feeding two streams (required because we gave two pads).• duration=longest – the output length will be the length of the longest input (the shorter one is padded with silence). Other options are shortest (stop when the shortest ends) or average. • weights=0.5 0.5 – a list of gain factors applied before mixing. 0.5 means ‑6 dB (half the amplitude). Two values are given, one for each input, so both streams are attenuated to 50 % of their original level. This prevents clipping when the two streams are summed.
[a]
Filtergraph output label
The mixed audio produced by amix is given the labela. Anything downstream can refer to it as [a].
-map 0:v
Mapping option
-map tells FFmpeg which streams to copy into the output file. 0:v means all video streams from input 0*. (If the file had more than one video track, they would all be copied.)
-map "[a]"
Mapping option
Adds the named output from the filtergraph ([a]) to the output file as an audio stream.
-c:v copy
Codec selection for video
-c:v = codec for video streams. copy means “do not re‑encode; just copy the bitstream as‑is.” This makes the operation lossless for video and very fast.
-c:a aac
Codec selection for audio
Choose the AAC encoder (the built‑in aac encoder or libfdk_aac if you compiled it).
-b:a 192k
Audio bitrate
Sets the target bitrate for the AAC encoder to 192 kbit/s. (If you prefer a quality‑based mode you could use -q:a 2 instead.)
mixed.mp4
Output file name
The final container that will hold the copied video and the newly‑encoded mixed audio.
3️⃣ Why each option matters
Option
Reason you need it
-filter_complex
You need a filtergraph because you are mixing two audio streams that come from the same input file. A simple -filter:a works only with a single input audio stream.
amix
This is the only built‑in filter that adds (mixes) multiple audio signals together.
duration=longest
Guarantees the mixed track will play for the full length of the longer source (otherwise you could end up with silence at the end if you used the default shortest).
weights=0.5 0.5
Prevents clipping. Adding two full‑scale signals can produce samples > 1.0, which FFmpeg would automatically clip (hard distortion). Halving each signal gives you headroom. You can change the values to bias one track louder than the other (e.g., weights=0.8 0.2).
-c:v copy
Saves time and preserves the original video quality. If you wanted to re‑encode (e.g., down‑scale), you would replace copy with something like -c:v libx264 -crf 23.
-b:a 192k
A reasonable quality/size trade‑off for AAC. You can go lower (128k) if you need more space, or higher (256k) for music‑heavy content.
-map statements
Explicit mapping avoids FFmpeg’s default stream selection (which could pick the first audio track only, ignoring the mixed one). By mapping both video and [a] we guarantee the output contains exactly what we want.
4️⃣ Common pitfalls & how to avoid them
Symptom
Why it happens
Fix
“Invalid argument for filter ‘amix’”
The weights= list is missing a space between numbers, or you used a comma.
The syntax must be weights=0.5 0.5 (space‑separated).
“[Parsed_amix …] overflow” (clipping)
You omitted the weights or set them too high, so the summed signal exceeds 1.0.
Add weights=0.5 0.5 (or lower values) or enable a limiter after amix: amix=…[a];[a]alimiter[aout].
“Stream specifier ‘0:a:1’ matches no streams”
The source file does not actually have a second audio stream, or the index is different.
Run ffprobe -i input.mp4 -show_streams -select_streams a to see the exact indices. Adjust [0:a:0] / [0:a:1] accordingly.
“[a] not found” after -map
The filtergraph label was misspelled or placed inside the wrong quotes.
Make sure the label [a] appears exactly as the output of the filtergraph and that the whole filtergraph string is wrapped in single quotes (or double quotes on Windows).
“Codec not found” for aac
You are using a build of FFmpeg that was compiled without the native AAC encoder.
Use -c:a libfdk_aac (if you have the commercial FDK library) or install a full build (e.g., from ffmpeg.org or Gyan).
“File not found” for mixed.mp4 after the command finishes
You ran the command from a directory where you don’t have write permission, or the output file already existed and was locked.
Run the command from a writable folder or give a different output name.
5️⃣ Variations you might find useful
Goal
Command snippet (replace the original part)
Notes
Keep the original audio and add the mixed track
Add another -map for the original tracks: -map 0:a:0 -map 0:a:1 -map "[a]"
The output will have three audio streams (voice, music, and the mix).
Bias the voice louder than the music
weights=0.8 0.2
80 % of voice, 20 % of music.
Use a limiter to avoid any clipping
amix=…[mix];[mix]alimiter=limit=0.95[a]
alimiter clamps peaks to 0.95 of full scale.
Encode the mixed audio with Opus (better quality at low bitrates)
-c:a libopus -b:a 96k
Opus works in MP4 containers only on newer players; otherwise use WebM.
Force the output duration to the shortest track
duration=shortest
Useful for voice‑over where you want the music to stop when the narration ends.
Mix more than two audio tracks
Add more pads: [0:a:0][0:a:1][0:a:2]amix=inputs=3:…
inputs= must match the number of pads you list.
Do not attenuate (keep full levels) but add a limiter
Omit weights and add a limiter: amix=inputs=2:duration=longest[raw];[raw]alimiter=limit=0.99[a]
This keeps original levels but prevents clipping via the limiter.
One‑liner without -filter_complex (only works if you have exactly two audio streams and want them summed automatically)
Take audio stream 0 and audio stream 1 from the input, halve each (weights 0.5), add them together (amix), keep the longest length, and label the result [a].
-map 0:v
Put the video stream(s) from input 0 into the output unchanged.
-map "[a]"
Put the mixed audio [a] into the output as the sole audio track.
-c:v copy
Do not re‑encode video; just copy the bitstream.
-c:a aac -b:a 192k
Encode the mixed audio as AAC at 192 kbit/s.
mixed.mp4
Write everything to a new file called mixed.mp4.
Bottom line
amix is the workhorse that actually adds the two audio streams.
weights=0.5 0.5 prevents clipping by lowering each stream’s level.
duration=longest ensures you don’t lose the tail of the longer track.
-map tells FFmpeg exactly which streams to keep (video + the new mixed audio).
-c:v copy makes the operation fast and lossless for video; -c:a aac -b:a 192k gives you a reasonably sized, widely compatible audio track.
Run the command, open mixed.mp4 in any player, and you’ll hear the two original audio tracks blended together as a single, clean audio stream. If you need any tweak (different volumes, a limiter, a different codec, etc.), just change the corresponding parameter in the command. Happy encoding!