Prompt
How do I troubleshoot failed video conversion jobs in the cloud?
Latest observation
Troubleshooting failed video conversion jobs in the cloud is mostly about narrowing down where the failure happened: upload/input, queue/orchestration, transcoding worker, storage/output, or downstream delivery. Here’s a practical approach.
1) Start with the job record
Look up the failed job and confirm:
- Job ID / trace ID
- Input file path / bucket / URL
- Requested output formats
- Worker/instance/container that processed it
- Timestamps: queued, started, failed
- Exit code / error message / retry count
- User/account/tenant context
If your system supports it, correlate everything with a single trace ID so you can follow the request through logs, queue, and storage events.
2) Categorize the failure stage
A. Input / upload issues
Symptoms:
- File not found
- Corrupt upload
- Unsupported codec/container
- Zero-byte file
- Wrong MIME type or bad metadata
Check:
- Is the source object present and readable?
- Did the upload finish successfully?
- Does the file validate with tools like
ffprobe? - Is the input within supported limits (size, duration, codec, resolution)?
Useful checks:
- Can the worker download the file?
- Does the object storage URL or signed URL expire too soon?
- Are there permissions issues on the source bucket/container?
B. Queue / orchestration issues
Symptoms:
- Job never starts
- Job stays “queued”
- Job starts then gets requeued repeatedly
- Duplicate jobs
Check:
- Queue depth and consumer health
- Dead-letter queue entries
- Worker autoscaling status
- Message visibility timeout / ack behavior
- Retry policy causing rapid failure loops
Look for:
- Permission problems reading from queue
- Poison messages
- Serialization/deserialization errors in job payloads
- Scheduler/controller crashes
C. Transcoding worker issues
Symptoms:
- FFmpeg or encoder exits with a non-zero code
- Jobs fail at the same percentage
- Out-of-memory, timeout, or disk-full errors
Check:
- Worker logs around the failure time
- CPU, memory, and disk utilization
- Container limits / cgroup OOM kills
- Temporary workspace capacity
- GPU/accelerator availability if used
Common causes:
- Bad codec parameters
- Too many threads for the allocated CPU
- Temp disk too small for intermediate files
- Instance timeout too low for long videos
- Missing system libraries or encoder binaries
D. Output / storage issues
Symptoms:
- Transcode succeeds but output is missing
- Upload to destination fails
- Output files are truncated or inaccessible
Check:
- Destination bucket/path permissions
- Object size limits
- Network connectivity to storage
- KMS/encryption permissions if using encrypted storage
- Multipart upload completion
- Cleanup steps accidentally deleting outputs
E. Delivery / playback issues
Symptoms:
- Job marked successful, but playback fails
- HLS/DASH manifests load but segments don’t
- Output format incompatible with player
Check:
- Manifest references valid segment paths
- Segment files exist and are readable
- Codec/profile/settings are compatible with the target player/device
- CDN cache invalidation if content was replaced
- CORS and signed URL configuration
3) Inspect logs with the right filters
Search logs by:
- Job ID
- Input filename
- Worker hostname/pod/container ID
- Exact failure timestamp
- Error keywords:
ffmpeg,timeout,OOM,permission denied,No space left,invalid data
Look for:
- The first error, not just the final one
- Stack traces from application code
- Encoder stderr output
- Retries and backoff behavior
If possible, enable structured logging with fields like:
job_idtenant_idinput_urioutput_uriworker_idsteperror_code
4) Validate the media file
Before blaming infrastructure, verify the media itself.
Run checks like:
ffprobe input.mp4mediainfo input.mp4ffmpeg -v error -i input.mp4 -f null -
Things to inspect:
- Container corruption
- Variable frame rate issues
- Missing audio/video streams
- Unsupported codecs or profiles
- Weird metadata or timestamps
- Huge resolution or bitrate causing resource exhaustion
Try transcoding a small sample or a known-good file with the same settings to isolate whether the issue is file-specific or config-specific.
5) Check resource and limit problems
Cloud jobs often fail because the default resources are too small.
Review:
- Memory limits
- CPU limits
- Ephemeral disk size
- Max runtime / job timeout
- Network throughput
- File descriptor limits
Typical failure patterns:
- OOM kill: process exits unexpectedly, no clean error
- Disk full: temp files can’t be written
- Timeout: long jobs killed by orchestrator
- Throttling: storage or API rate limits cause retries/failures
6) Verify permissions and secrets
A lot of cloud failures are authorization-related.
Confirm access to:
- Source storage
- Destination storage
- Queue/topic/subscription
- KMS keys or encryption secrets
- Secrets manager / config store
- Container registry images
Also check:
- Expired credentials
- Rotated keys not updated in workers
- IAM role changes
- Cross-account access policies
7) Reproduce in a controlled environment
To narrow the cause:
- Run the same command locally or in a dev/staging worker
- Use the same input file and parameters
- Compare environment versions:
- FFmpeg version
- OS image
- Library versions
- Container image digest
- Reduce complexity:
- Lower resolution
- Fewer outputs
- Disable optional filters
- Process shorter clips
If the job fails only in cloud, suspect:
- Resource limits
- Network/storage permissions
- Environment drift
- Instance-specific hardware/driver issues
8) Watch for common FFmpeg/transcoding pitfalls
If you use FFmpeg, common issues include:
- Incorrect
-mapsettings causing missing streams - Pixel format incompatibilities
- Unsupported encoder settings
- Broken timestamps
- Corrupt audio streams
- HLS segment alignment issues
- Hardware encoder initialization failures
Capture full stderr from FFmpeg and store it with the job record.
9) Build better observability
To make future troubleshooting easier:
- Emit job lifecycle events: queued, started, progress, failed, succeeded
- Store encoder stderr/stdout
- Add metrics for:
- Failure rate by reason
- Average transcode duration
- Queue wait time
- Retry counts
- OOM/timeouts
- Use distributed tracing across API, queue, worker, and storage calls
- Keep recent failed inputs for replay in staging
10) Create a standard debug checklist
For every failed job, answer:
- Was the input present and valid?
- Did the worker start successfully?
- Did the encoder return a specific error?
- Was there enough CPU/memory/disk/time?
- Did the worker have permission to read/write objects?
- Did the output upload complete?
- Did the manifest/playlist reference valid segments?
- Was the failure reproducible?
Quick triage commands
If you have shell access on a worker/container:
- Check logs:
journalctl -u your-servicekubectl logs <pod> --previous
- Inspect media:
ffprobe -v error -show_streams -show_format input.mp4
- Test encode:
ffmpeg -v error -i input.mp4 -f null -
- Check disk:
df -h
- Check memory:
free -h
- Check process exit:
echo $?