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;
					}
				}
			}
        }
相关推荐
IMPYLH7 分钟前
Linux 的 b2sum 命令
linux·运维·服务器·bash
renhongxia112 分钟前
PostTrainBench:LLM 代理能否自动化 LLM 后培训?
运维·人工智能·深度学习·机器学习·架构·自动化·transformer
celeste031029 分钟前
Redis Summary
linux·运维·服务器·redis·笔记
Sylvan.C31 分钟前
Windows+Ubuntu 双系统安装超详细保姆级教程2026,包括系统安装、英伟达独显驱动安装以及双系统时间同步的所有过程
linux·运维·ubuntu
星辰徐哥31 分钟前
鸿蒙金融理财全栈项目——上线与运维、用户反馈、持续迭代
运维·金融·harmonyos
伴我与影32 分钟前
Ubuntu 安装 NVIDIA 显卡驱动
linux·运维·ubuntu
unsynchronized33 分钟前
OpenClaw 安装指南:Linux 与 Windows 系统详细教程
linux·运维·windows·ai
A10169330711 小时前
Nginx 之Rewrite 使用详解
运维·nginx
志栋智能1 小时前
运维超自动化:从成本中心到价值创造者的蜕变
运维·人工智能·自动化
宁波阿成1 小时前
OpenClaw 在 Ubuntu 22.04.5 LTS 上的命令版操作手册
linux·运维·ubuntu·openclaw·龙虾