ffmpeg3.1.1版本连接ftp服务器失败

发现这个问题是在ffmpeg4之后修复的:

原因在于libavformat文件下的ftp.c文件:
修改方法:加入在TCP控制连接时加入应答代码202:

cpp 复制代码
static int ftp_features(FTPContext *s)
{
    static const char *feat_command        = "FEAT\r\n";
    static const char *enable_utf8_command = "OPTS UTF8 ON\r\n";
    static const int feat_codes[] = {211, 0};
    static const int opts_codes[] = {200,202 ,451, 0};

    av_freep(&s->features);
    if (ftp_send_command(s, feat_command, feat_codes, &s->features) != 211) {
        av_freep(&s->features);
    }

	if (ftp_has_feature(s, "UTF8")) {
		int ret = ftp_send_command(s, enable_utf8_command, opts_codes, NULL);
		if (ret == 200 || ret == 202)
			s->utf8 = 1;
	}

    return 0;
}

否则的话将会引起的函数调用有:

ftp_status()--->ftp_get_line()----->ftp_getc()------->ffurl_read()------>retry_transfer_wrapper() (avic.c)
具体在ffurl_read()函数中无法退出的原因还没有得出结论

暂时先排查到ffurl_read(),总之引起的原因是状态码列表不存在服务器返回的状态码,该部分的判断在ftp_status()函数:

cpp 复制代码
 if (!code_found) {
            if (err >= 500) {
                code_found = 1;
                result = err;
			}
			else
			{
				for (i = 0;  response_codes[i]; ++i) {
					if (err == response_codes[i]) {
						code_found = 1;
						result = err;
						break;
					}
				}
			}
        }
相关推荐
solihawk几秒前
服务器内存被谁“偷”走了?
服务器·数据库
域中四大22 分钟前
rk3568中修改波特率
linux·运维
互联网推荐官22 分钟前
大模型应用开发的上下文工程与推理链路深度拆解
大数据·运维·人工智能
风曦Kisaki35 分钟前
# Linux Shell 编程入门 Day01:Shell 基础认知、脚本编写规范、变量四大类型、数值运算
linux·运维·chrome
德彪稳坐倒骑驴37 分钟前
SQL连续登录问题
服务器·数据库·sql
云智慧AIOps社区44 分钟前
云智慧亮相第二十八届智能体驱动的GOPS全球运维大会2026 · 深圳站!以运维智能体 Castrel AI (SRE Agent)保障系统稳定可靠!
运维·人工智能·ai agent·运维自动化·sre 智能体
校羽干1 小时前
ubuntu22.04 安装卸载更新 ollama
运维·服务器
大强同学1 小时前
Obsidian链接收藏自动化
运维·自动化
MXsoft6181 小时前
**七八个系统来回切换****?用****一体化运维监控管理平台**
运维
淘矿人1 小时前
2026年4月-DeepSeek V4 vs GPT-5.5深度对比测评:weelinking一键切换实测
服务器·数据库·人工智能·python·gpt·学习·php