FFmpeg报错‘matches no streams Stream specifier '' in filtergraph description’的修复方案(针对仅含视频流的a.mp4音频合成命令)
Alright, let's break down what's going wrong here and fix that FFmpeg command for you.
Why the Error Happens
The error ffmpeg matches no streams Stream specifier '' in filtergraph description pops up because your first input file a.mp4 only contains a video stream, no audio stream. When you reference [0] in your filter complex, you're telling FFmpeg to target the first input's audio stream—but there isn't one. The volume, atrim, and adelay filters are all audio-only, so FFmpeg can't find a valid stream to apply them to.
Fix 1: If You Don't Need Audio from a.mp4
If your goal is just to process the audio from b.mp3 (trim it, adjust volume, etc.) and you don't actually need anything from a.mp4, simplify the command by removing the unused video input and audio references:
ffmpeg -y -i b.mp3 -filter_complex '[0]volume=1,atrim=start=0:end=5.796,adelay=0|0' mergeAudio.mp3
Fix 2: If You Need to Mix Audio (Use Silent Audio as a Placeholder)
If you intended to mix two audio streams (e.g., b.mp3 plus a silent track matching your original [0] parameters), replace the missing audio from a.mp4 with a generated silent audio stream. We'll use FFmpeg's anullsrc filter to create this placeholder:
ffmpeg -y -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -i b.mp3 -filter_complex '[0]volume=1,atrim=start=0:end=5,adelay=0|0[aud0];[1]volume=1,atrim=start=0:end=5.796,adelay=0|0[aud1];[aud0][aud1]amix=2' mergeAudio.mp3
This command generates a stereo, 44100Hz silent track as the first input, giving FFmpeg a valid audio stream to apply your [0] filters to.
Quick Tip to Verify Input Streams
Next time, if you're unsure what streams a file contains, run this command to list all streams for your inputs:
ffmpeg -i a.mp4 -i b.mp3
It will clearly show whether each file has video, audio, or subtitle streams.
内容的提问来源于stack exchange,提问作者jzwb

