Troubleshooting Guide
Common issues and their solutions when using Laravel Shaka Packager.
Installation issues
Binary not found
Error:
RuntimeException: Command execution failed - the underlying `Process` call
could not find or execute /usr/local/bin/packager
A missing or non-executable binary surfaces as a RuntimeException from the
underlying Process call the first time the packager binary is invoked —
see Architecture for details.
Solutions:
-
Install Shaka Packager:
# Linuxwget https://github.com/shaka-project/shaka-packager/releases/download/v3.4.2/packager-linux-x64sudo mv packager-linux-x64 /usr/local/bin/packagersudo chmod +x /usr/local/bin/packager# macOSbrew install shaka-packager -
Update config path:
# .envPACKAGER_PATH=/path/to/packager -
Verify installation:
php artisan shaka:info
Binary not executable
Error:
Binary is not executable
Solution:
chmod +x /usr/local/bin/packager
Configuration issues
Temporary directory not writable
Error:
Temporary directory is not writable
Solutions:
-
Create directory:
mkdir -p storage/app/packager/tempchmod 755 storage/app/packager/temp -
Update config:
// config/laravel-shaka.php'temporary_files_root' => storage_path('app/packager/temp'),
Insufficient storage space
Error:
InsufficientStorageException: Insufficient storage space in [/cache/temp/packager]: 314572800 bytes free, 1610612736 bytes required.
This is thrown by a deliberate pre-flight check (see Storage Space Guards), not a filesystem error - the job never started, so nothing needs cleanup.
Solutions:
- If
temporary_files_rootorcache_files_rootis a size-limited mount (e.g. a tmpfs), free up space or increase its size. - If this happens routinely under concurrent load, the real fix is usually
fewer concurrent jobs, not more disk space - lower your queue's
concurrency (e.g. Horizon's
maxProcesses) soworkers x largest expected job footprintfits comfortably. - If the floor itself is miscalibrated, tune it:
PACKAGER_TEMPORARY_MIN_FREE/PACKAGER_CACHE_MIN_FREE(bytes), andPACKAGER_TEMPORARY_SIZE_MULTIPLIERfor the job-size-aware check. - To turn a check off entirely, set its env var to
0.
Timeout errors
Error:
RuntimeException: Process timeout exceeded
Solutions:
-
Increase timeout in config:
// config/laravel-shaka.php'timeout' => 60 * 60 * 8, // 8 hours -
Or set dynamically:
$packager = app(ShakaPackager::class);$packager->setTimeout(28800); // 8 hours
Packaging issues
Unknown field in stream descriptor
Error:
Unknown field in stream descriptor: filename_with,comma.mp4
Solutions:
-
Enable generic input (recommended):
# .envPACKAGER_FORCE_GENERIC_INPUT=true -
Or sanitize filename manually:
use Foxws\Shaka\Support\MediaHelper;$sanitized = MediaHelper::sanitizeFilename($filename);
Empty MediaCollection
Error:
InvalidArgumentException: MediaCollection cannot be empty
Solution:
// Ensure you call open() before adding streams
Shaka::open('input.mp4') // ← Must call open first
->addVideoStream('input.mp4', 'output.mp4')
->export()
->save();
No streams configured
Error:
RuntimeException: No streams configured. Use addVideoStream() or addAudioStream() first.
Solution:
// Add at least one stream before exporting
Shaka::open('input.mp4')
->addVideoStream('input.mp4', 'video.mp4') // ← Add streams
->export()
->save();
Encryption issues
SAMPLE-AES not working in browser
Problem: Encrypted HLS doesn't play in web browsers
Solution: Use cbc1 protection scheme for browser compatibility:
Shaka::open('input.mp4')
->addVideoStream('input.mp4', 'video.ts') // Use .ts not .mp4
->withHlsMasterPlaylist('master.m3u8')
->withEncryption([
'keys' => 'label=:key_id=abc:key=def',
'protection_scheme' => 'cbc1', // Browser-compatible
'clear_lead' => 0,
])
->export()
->save();
See AES Encryption for the full list of protection schemes and device compatibility.
Encryption key not found
Error:
Cannot load key from URI
Solutions:
-
Ensure key file is accessible:
// Make sure the key URL is publicly accessible->setKeyUrlResolver(fn ($key) => Storage::disk('public')->url($key)) -
Check CORS settings for cross-origin requests
Storage issues
S3 permission denied
Error:
S3Exception: Access Denied
Solutions:
-
Check IAM permissions:
{"Effect": "Allow","Action": ["s3:GetObject","s3:PutObject","s3:DeleteObject"],"Resource": "arn:aws:s3:::your-bucket/*"} -
Verify credentials in
.env:AWS_ACCESS_KEY_ID=your-keyAWS_SECRET_ACCESS_KEY=your-secretAWS_DEFAULT_REGION=us-east-1AWS_BUCKET=your-bucket
Cannot copy files from temporary directory
Error:
RuntimeException: Cannot copy files: temporary directory not set
Solution: This occurs when using packageWithBuilder() directly. Use the full fluent API instead:
// ✗ Wrong
$builder = CommandBuilder::make()->addVideoStream(...);
$packager->packageWithBuilder($builder)->toDisk('s3');
// ✓ Correct
Shaka::open('input.mp4')
->addVideoStream('input.mp4', 'output.mp4')
->export()
->toDisk('s3')
->save();
Performance issues
Processing too slow
Solutions:
-
Use local disk for temporary files:
'temporary_files_root' => '/dev/shm/packager', // RAM disk -
Reduce quality/bitrate settings
-
Use fewer ABR variants
-
Process in background queue:
ProcessMediaJob::dispatch($inputPath);See Queue Integration for a full example.
Memory issues
Solutions:
-
Increase PHP memory limit:
memory_limit = 512M -
Process smaller chunks
-
Use queue workers with memory limit:
php artisan queue:work --memory=512
Debugging
Enable logging
# .env
PACKAGER_LOG_CHANNEL=stack
// Check logs
tail -f storage/logs/laravel.log
Get raw command
$command = Shaka::open('input.mp4')
->addVideoStream('input.mp4', 'output.mp4')
->export()
->getCommand();
dd($command);
Test packager directly
/usr/local/bin/packager --version
/usr/local/bin/packager in=input.mp4,stream=video,output=output.mp4
Getting help
If you're still experiencing issues:
- Run verification:
php artisan shaka:info - Check logs in
storage/logs/laravel.log - Test packager binary directly
- Create an issue with:
- Error message
- PHP version
- Laravel version
- Packager version
- Relevant code snippet
Common pitfalls
- Forgetting to call
open()before adding streams - Using wrong file extension for encrypted content (.mp4 vs .ts)
- Not setting timeout for large files
- Special characters in filenames without sanitization
- Incorrect disk configuration in filesystems.php
- Mixing input/output paths from different contexts