Advanced Topics - cleverdevil/squishy GitHub Wiki
Advanced Topics
This page covers advanced topics for Squishy power users and developers.
Metadata Sidecar Files
For each successfully transcoded file, Squishy creates a JSON sidecar file with comprehensive metadata about the transcode. These files are stored alongside the transcoded media with the same name and an additional .json
extension.
Sidecar File Content
The sidecar file includes:
{
"original_path": "/path/to/original/media.mkv",
"media_id": "a1b2c3d4e5f6",
"title": "Movie Title",
"year": 2023,
"type": "movie",
"poster_url": "https://example.com/poster.jpg",
"thumbnail_url": "https://example.com/thumbnail.jpg",
"preset_name": "720p-medium",
"completed_at": "2023-08-01T14:30:45.123456",
"output_size": "1.24 GB",
"duration": 7223.4
}
For TV shows, additional fields are included:
{
"show_id": "show123456",
"season_number": 2,
"episode_number": 5,
"show_title": "TV Show Name"
}
Using Sidecar Files
These metadata files are mainly for Squishy to keep track of completed transcode jobs, but they can also provide an integration point for additional tools. It is important to note that Squishy has no database backing it. Instead, Squishy relies on your media server for a content catalog, sidecar files for job history, and a JSON config file for everything else.
Manual Installation
While Docker is the recommended installation method, you can install Squishy manually:
- Clone the repository
- Install the required dependencies:
pip install -e .
- Create and edit a
config.json
file - Run Squishy:
python run.py
Custom Presets
You can create custom presets to fine-tune your transcoding settings:
- Create a new preset JSON file or modify the existing ones
- Define your presets following the format in the effeffmpeg documentation
- Import your presets through the admin interface
Example of a custom preset for extremely low bitrate:
{
"presets": {
"ultra-low": {
"container": ".mp4",
"codec": "h264",
"scale": "360p",
"audio_codec": "aac",
"audio_bitrate": "32k",
"bitrate": "250k",
"allow_fallback": true
}
}
}
API Usage
Squishy provides a basic API for advanced integrations. The API endpoints are:
/api/media
GET Returns a list of all media in the library.
/api/media/{media_id}
GET Returns detailed information about a specific media item.
/api/transcode
POST Start a new transcode job:
{
"media_id": "123456",
"preset": "high"
}
/api/jobs
GET List all transcoding jobs.
/api/jobs/{job_id}
DELETE Cancel a transcoding job.
WebSocket Events
Squishy uses WebSockets to provide real-time updates on transcoding jobs. The following events are available:
job_started
: A new job has startedjob_progress
: Job progress has been updatedjob_completed
: A job has completedjob_failed
: A job has failedjob_cancelled
: A job has been cancelled
You can subscribe to these events using JavaScript:
const socket = io();
socket.on('job_progress', function(data) {
console.log(`Job ${data.job_id} progress: ${data.progress}%`);
});
Monitoring
Squishy logs extensive information about its operations. To view the logs:
docker logs squishy
For more detailed logging, set the environment variable:
environment:
- LOG_LEVEL=DEBUG
Upgrading
To upgrade Squishy to a newer version:
-
Pull the latest changes:
git pull
-
Rebuild the Docker container:
docker compose down docker compose up --build -d
-
Check the logs for any migration messages:
docker logs squishy
Backing Up Configuration
To back up your Squishy configuration:
-
Copy the configuration file:
docker cp squishy:/config/config.json ./config_backup.json
-
(Optional) Back up your custom presets:
docker cp squishy:/app/squishy/presets ./presets_backup
Performance Tuning
For optimal performance:
- Use hardware acceleration when possible
- Adjust the
max_concurrent_jobs
based on your CPU/GPU capabilities - Use a fast SSD for the transcodes directory
- Ensure sufficient network bandwidth between containers