没有不值得去解决的问题,也没有不值得去学习的技术!

Troubleshooting 413 Request Entity Too Large When Uploading Videos to a File Server on the Douyin Open Platform

Douyin Open Platform, uploading a video to the file server, file size: 2.10 GB. Response: 413 Request Entity Too Large.

1. Douyin Open Platform, uploading a video to the file server, file size: 2.10 GB. Response: 413 Request Entity Too Large. See Figure 1.

Douyin Open Platform, uploading a video to the file server, file size: 2.10 GB. Response: 413 Request Entity Too Large.
Figure 1
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
 
<head>
    <title>413 Request Entity Too Large</title>
</head>
 
<body bgcolor="white">
    <h1>413 Request Entity Too Large</h1>
    <P>The requested resource does not allow request data with the requested method or the amount of data provided in
        the request exceeds the capacity limit.
        <hr />Powered by Tengine
</body>
 
</html>

2. Reviewing the documentation, Douyin Open Platform – Open API – Video Management – Douyin – Create Video – Upload Video: https://open.douyin.com/platform/doc/6848798087398295555 . Video file requirements: The video file size must not exceed 128M, and the duration must be within 15 minutes.

3. Douyin Open Platform, uploading a video to the file server, file size: 136 MB. Response: 502 Bad Gateway. See Figure 2.

Douyin Open Platform, uploading a video to the file server, file size: 136 MB. Response: 502 Bad Gateway.
Figure 2

4. Douyin Open Platform, uploading a video to the file server, file size: 117 MB. Response: 200. Upload successful. Time elapsed: 1 m 7.02 s. See Figure 3.

Douyin Open Platform, uploading a video to the file server, file size: 117 MB. Response: 200. Upload successful. Time elapsed: 1 m 7.02 s.
Figure 3

5. Note from the official documentation: For videos larger than 50M, chunked upload is recommended to reduce failures caused by gateway timeouts. For videos larger than 128M, chunked upload is required. The total video size must be within 4GB. The recommended size for a single chunk is 20MB, with a minimum of 5MB. The subsequent implementation logic for uploading videos: Regardless of size, all videos will be uploaded in chunks, with a single chunk size of 100 MB.

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系