FFmpeg直播仅输出240p,带复杂滤镜视频转720p报错求助
Hey Ricky, let's work through these two FFmpeg problems you're dealing with—they're both common gotchas, so we'll get you sorted out quickly.
1. Live Stream Only Outputs 240p Resolution
There are a few likely culprits here, let's break down the fixes step by step:
First, confirm your input source's resolution: Run this quick command to check what resolution your input is providing—if it's already 240p, FFmpeg won't upscale it automatically.
ffmpeg -i your_input_sourceLook for the
Stream #0:0line that lists the resolution (e.g.,1280x720).Explicitly set your target resolution in the push command: Add the
scalefilter and specify your desired resolution, paired with encoder settings optimized for streaming. Here's an example for a 720p stream:ffmpeg -i your_input_source -vf scale=1280:720 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k -f flv rtmp://your_streaming_urlThe
scale=1280:720forces 720p output, whilelibx264ensures efficient compression that streaming platforms can handle.Double-check your streaming platform settings: Some platforms default to low resolutions if your bitrate is too low. For 720p, aim for a bitrate between 2-4 Mbps (adjust based on content complexity—higher for fast-moving video).
2. Error: [AVFilterGraph @ 0x7f964163e9a0] No such filter: ''
This error almost always stems from a syntax mistake in your filter chain—here's how to fix it:
Watch for extra spaces or misplaced separators: The empty filter name error means FFmpeg is trying to parse a blank string as a filter, usually from accidental spaces around commas. For example, this is wrong:
# Incorrect—extra space before the comma ffmpeg -i input.mp4 -vf scale=1280:720 , some_complex_filter output.mp4Remove the space so the filters are separated cleanly with just a comma.
Use
-filter_complexfor multi-filter setups: When combining scaling with other complex filters,-filter_complexavoids confusion with stream references. Here's a correct example:ffmpeg -i input.mp4 -filter_complex "[0:v]scale=1280:720,drawtext=text='Live Stream':x=50:y=50:fontsize=24[v]" -map "[v]" output.mp4The
[0:v]explicitly references your input's video stream, and the comma chains the scale and drawtext filters without extra spaces.Check for invisible characters: If you copied the command from a webpage or formatted text, there might be hidden whitespace or special characters. Try typing the filter chain manually to rule this out.
内容的提问来源于stack exchange,提问作者Ricky

