Generate concise video summaries from video transcripts using AI-powered highlight extraction. This endpoint analyzes your transcript and identifies the most important segments to create a summary of your desired duration.What you’ll accomplish:
Extract key highlights from video transcripts
Generate summaries of specific durations
Receive webhook notifications when processing completes
Create engaging short-form content from long videos
You need a valid API key to use this endpoint. Get your API key from the API Access page in your Pictory dashboard.
Target duration for the video summary in seconds. The AI will select highlights that fit within this duration.Example: 30 for a 30-second summary, 60 for a 1-minute summary
Total duration of the source video in seconds. This helps the AI understand the full context when generating highlights.Example: 120 for a 2-minute video, 300 for a 5-minute video
Language code for the transcript content. Must be one of the supported languages.Supported values: en (English), es (Spanish), fr (French), de (German), it (Italian), pt (Portuguese), ja (Japanese), ko (Korean), zh (Chinese), ar (Arabic), hi (Hindi), ru (Russian), and more.Example: en for English, es for Spanish
Optional webhook URL where the summary results will be posted when processing completes. The webhook will receive a POST request with the summary data.Example: https://your-domain.com/api/webhooks/video-summary
Async Processing: This endpoint processes summaries asynchronously. You’ll receive a jobId immediately, and the actual summary will be generated in the background.
Webhook Notifications: If you provide a webhook URL, Pictory will POST the completed summary to that URL when processing finishes. This is the recommended way to receive results rather than polling.
Transcript Format: Ensure your transcript segments are in chronological order with accurate start and end times. The AI uses timing information to create seamless highlight clips.
Duration Limits: The highlight_duration should be shorter than your total transcript duration. The AI will select the most important segments that fit within the target duration.
Set up a webhook endpoint to receive completed summaries:
Report incorrect code
Copy
Ask AI
from flask import Flask, request, jsonifyimport requestsapp = Flask(__name__)@app.route('/webhooks/video-summary', methods=['POST'])def handle_summary_webhook(): """ Receive and process completed video summary """ try: summary_data = request.json # Log the received data print(f"Received summary for job: {summary_data.get('jobId')}") # Process the summary # (The exact structure depends on what Pictory sends) job_id = summary_data.get('jobId') highlights = summary_data.get('highlights', []) # Save to database, trigger next step, etc. save_summary_to_database(job_id, highlights) # Optionally trigger video creation with the highlights create_video_from_highlights(highlights) return jsonify({"status": "success"}), 200 except Exception as e: print(f"Error processing webhook: {str(e)}") return jsonify({"status": "error", "message": str(e)}), 500def save_summary_to_database(job_id, highlights): # Your database logic here passdef create_video_from_highlights(highlights): # Create a video project using the highlights passif __name__ == '__main__': app.run(port=3000)