Beim Veröffentlichen kleiner Videos mit 3 MB oder 2 MB funktioniert es einwandfrei, aber wenn ich zu größeren Videos wie 28 MB gehe, wird mir dieser Fehler angezeigt: Die Gesamtanzahl der Blöcke ist ungültig
{
"success": false,
"error": "Failed to upload video: Client error: `POST https://open.tiktokapis.com/v2/post/publish/video/init/` resulted in a `400 Bad Request` response:\n{\"error\":{\"code\":\"invalid_params\",\"message\":\"The total chunk count is invalid\",\"log_id\":\"2025012015022992B6C5AD85BB021DC (truncated...)\n",
"publish_id": null
}
So berechnen Sie die Blockgröße eines Videos, das ich in public/videos gespeichert habe
Beim Veröffentlichen kleiner Videos mit 3 MB oder 2 MB funktioniert es einwandfrei, aber wenn ich zu größeren Videos wie 28 MB gehe, wird mir dieser Fehler angezeigt: Die Gesamtanzahl der Blöcke ist ungültig [code]{ "success": false, "error": "Failed to upload video: Client error: `POST https://open.tiktokapis.com/v2/post/publish/video/init/` resulted in a `400 Bad Request` response:\n{\"error\":{\"code\":\"invalid_params\",\"message\":\"The total chunk count is invalid\",\"log_id\":\"2025012015022992B6C5AD85BB021DC (truncated...)\n", "publish_id": null } [/code] So berechnen Sie die Blockgröße eines Videos, das ich in public/videos gespeichert habe [code] // Get video from public folder $videoPath = public_path('videos/xyz.mp4'); if (!file_exists($videoPath)) { return response()->json([ 'success' => false, 'error' => 'Video file not found in public/videos folder' ], 404); }
// Calculate video parameters with TikTok specs $videoSize = (int)filesize($videoPath); $minChunkSize = 5 * 1024 * 1024; // 5MB minimum $maxChunkSize = 64 * 1024 * 1024; // 64MB maximum
[/code] und das ist vollständiger Code [code] public function uploadVideo(Request $request) { $account_id = auth()->user()->account_id; $user_id = $request->user_id;
// Get video from public folder $videoPath = public_path('videos/xyz.mp4'); if (!file_exists($videoPath)) { return response()->json([ 'success' => false, 'error' => 'Video file not found in public/videos folder' ], 404); }
// Calculate video parameters with TikTok specs $videoSize = (int)filesize($videoPath); $minChunkSize = 5 * 1024 * 1024; // 5MB minimum $maxChunkSize = 64 * 1024 * 1024; // 64MB maximum
// Handle small videos ( 4 * 1024 * 1024 * 1024) { // 4GB max return response()->json([ 'success' => false, 'error' => 'Video size must be less than 4GB' ], 400); }
// Validate chunk count if ($totalChunks > 1000) { return response()->json([ 'success' => false, 'error' => 'Invalid chunk count. Must be maximum 1000' ], 400); }
$initData = json_decode($initResponse->getBody(), true); if (!isset($initData['data']['upload_url'])) { throw new \Exception('Failed to get upload URL: ' . json_encode($initData)); }
// Upload video chunks $videoFile = null; try { $videoFile = fopen($videoPath, 'r'); if (!$videoFile) { throw new \Exception('Failed to open video file'); }
return response()->json([ 'success' => false, 'error' => 'Failed to upload video: ' . $e->getMessage(), 'publish_id' => $publishId ?? null ], 500); } } [/code] Ich habe versucht, die Variable $totalChunks so zu ändern, dass sie statisch auf 1 ist, aber es wird mir ein anderer Fehler angezeigt [code]{ "success": false, "error": "Failed to upload video: Client error: `POST https://open.tiktokapis.com/v2/post/publish/video/init/` resulted in a `400 Bad Request` response:\n{\"error\":{\"code\":\"invalid_params\",\"message\":\"The chunk size is invalid\",\"log_id\":\"20250120150836CF3EDDD9FB5BFC1C0A85\"}}\n", "publish_id": null } [/code]
Beim Veröffentlichen von kleinen Videos mit 3 MB und 2 MB funktioniert es gut, solange es nicht in Stücke aufgeteilt wird, d. h. weniger als 5 MB, und die totalchunks-Variable gleich 1 ist, wie Sie...
Ich muss eine Möglichkeit implementieren, Videos von unserer Website auf YouTube hochzuladen. Ich habe die App bereits in Google Cloud registriert und alle erforderlichen Client -ID, Client...
Ich habe ein Array in Blöcke unterteilt. Ich würde gerne fragen, wie es möglich ist, sie einzuschleifen, um jeden Block als Array zu verwenden und ihre Daten zu drucken. Hier ist mein bisheriger...
Ich versuche, meine Microsoft Forms -Anwendung als Einzeldateianwendung zu veröffentlichen.
Ich habe Word -Dokumente im Ordner Ressourcen. Dokument kann nicht gefunden werden. Wenn ich es lokal...