使用 Instagram API 上传视频时出现错误

问题描述 投票:0回答:4

我正在尝试通过 API 将视频上传到 Instagram。我收到以下错误。请指教 通过此方法上传图片成功。

参考:https://developers.facebook.com/docs/instagram-api/reference/ig-user/media_publish#creating

请求1:

https://graph.facebook.com/xxxxxxx/media?media_type=VIDEO&video_url=/Users/vijayaraghavandevaraj/Downloads/Drops.mp4&access_token={{token}}
- 成功

回应:

{
    "id": "xxxxxxxxxxxx"
}

请求2: 发帖

https://graph.facebook.com/xxxxxxxxxx/media_publish?creation_id=xxxxxxx&access_token={{token}}
- 失败

回应:

{
    "error": {
        "message": "The video file you selected is in a format that we don't support.",
        "type": "OAuthException",
        "code": 352,
        "error_subcode": 2207026,
        "is_transient": false,
        "error_user_title": "Unsupported format",
        "error_user_msg": "The video format is not supported. Please check the specs for the supported streams format",
        "fbtrace_id": "AA3qcWZCmMsp0OfEE_m1cLJ"
    }
}
instagram-api
4个回答
1
投票

简短回答:您无法上传本地媒体文件。

虽然错误消息暗示了错误的视频规格方向,但实际错误来自于video_url查询参数是本地路径。

来自 instagram-api 文档

视频和卷轴所需。仅适用于视频和卷轴。视频的路径。 我们使用传入的 URL 对视频进行 cURL,因此它必须位于公共服务器上。

通过 ffmpeg 创建的视频,其规格如上文所建议的那样,可以使用。


1
投票
我发现 Instagram 需要相当多的视频参数才能完全按照其定义 - Graph API 为 Facebook 接受的相同视频可能不会为 Instagram 接受。即使通过 Instagram 网站上传接受的视频也不一定通过 API 接受。 我在这个网站上找到了一个工作示例:

https://ffmpegfromzerotohero.com/blog/ffmpeg-instagram-best-practices/

ffmpeg -framerate 1/60 -i your_still_picture.jpg -i your_audio_track.wav -map 0:v -map 1:a -r 25 -c:v h264 -tune stillimage -crf 18 -c:a aac -b:a 128k -ac 2 -ar 44100 -pix_fmt yuv420p -max_muxing_queue_size 1024 -shortest your_final_instagram_video.mp4
请记住,API 不接受超过 60 秒的视频(这将导致不同的错误),这是使用 Web 界面时不存在的另一个限制。


0
投票
可能的原因可能是视频要求。查看

https://developers.facebook.com/docs/instagram-api/reference/ig-user/media


0
投票
使用此配置在 Instagram 卷轴规格中进行视频妥协

© www.soinside.com 2019 - 2024. All rights reserved.