在简单的 Instagram Graph API 请求上遇到错误。我正在尝试在发布视频容器之前检查其状态。
如果我跳过这一步,休眠 30 秒(以确保 Facebook 服务器有足够的时间来处理容器)并直接发布,它就可以工作。所以您知道容器 ID 和用户访问令牌都是准确的。
但是如果我插入这个状态检查步骤,响应400,错误的请求等。响应的内容是“抱歉,此内容现在不可用”
这是官方文档的链接:https://developers.facebook.com/docs/instagram-api/reference/ig-container
下面是我的代码。有任何想法吗?
编辑:弄清楚了。文档说该 URL 是 graph.instagram.com,但它应该是 graph.facebook.com。文档有误吗?
url = f"https://graph.instagram.com/{container_id_response.json()['id']}"
container_ready = False
while not container_ready:
time.sleep(3)
# Check status
params = {"fields": "status,id",
"access_token":credentials['FB_USER_ACCESS_TOKEN']}
response = status_response = requests.get(url, params=params)
if response.json()['status_code'] == "FINISHED":
container_ready = True
Run Code Online (Sandbox Code Playgroud) python facebook-graph-api python-requests instagram-graph-api
尝试以 GothamProBold 字体将字幕刻录到 FFMPEG 视频中。无论我做什么,它都会恢复为 Helvetica。从控制台,我看到 FFMPEG 似乎加载字体没有错误。然后切换到字体提供商“coretext”
[Parsed_subtitles_0 @ 0x7fed054048c0] Loading font file '/Projects/Fonts/GothaProBol.otf'
[Parsed_subtitles_0 @ 0x7fed054048c0] Using font provider coretext
[Parsed_subtitles_0 @ 0x7fed054048c0] fontselect: (GothaProBol.otf, 400, 0) -> /System/Library/Fonts/Helvetica.ttc, -1, Helvetica
Run Code Online (Sandbox Code Playgroud)
看起来它已经加载了我的字体,然后加载了可能是系统默认的 Helvetica 字体。我的猜测是我选择的字体实际上并未加载。
FFMPEG命令(从python调用)如下:
ffmpeg_cmd = ["ffmpeg",
"-i", self.source_video_uri,
"-y",
"-c:v", "prores", "-profile:v", "1",
"-c:a", "pcm_s16be",
"-vf", f"subtitles={srt_uri}:fontsdir=/Projects/Fonts:force_style='Fontname=GothaProBol.otf'",
f"{self.source_video_uri}_render.mov"]
subprocess.call(ffmpeg_cmd)
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
更新:在 libass 头文件“ass.h”中找到此设置 - ffmpeg 在使用字幕过滤器时调用该文件。不知道当 ffmpeg 调用 libass 时如何实际设置此变量,但它就是这样。182行:
* \brief Default Font provider to load fonts in libass' database …Run Code Online (Sandbox Code Playgroud)