1
- # Rendiff API Documentation
1
+ # FFmpeg API Documentation
2
2
3
- Complete API reference for the Rendiff FFmpeg API service.
3
+ Complete API reference for the production-ready FFmpeg API service.
4
4
5
5
## Table of Contents
6
6
@@ -15,20 +15,20 @@ Complete API reference for the Rendiff FFmpeg API service.
15
15
16
16
## Overview
17
17
18
- The Rendiff API provides a RESTful interface to FFmpeg's media processing capabilities with hardware acceleration support.
18
+ The FFmpeg API provides a RESTful interface to FFmpeg's media processing capabilities with hardware acceleration support.
19
19
20
20
> ** 💡 New to setup?** See the [ Setup Guide] ( SETUP.md ) for deployment instructions.
21
21
22
22
All API requests should be made to:
23
23
24
24
```
25
- http://your-server :8000/api/v1
25
+ http://localhost :8000/api/v1
26
26
```
27
27
28
28
### Base URL Structure
29
29
30
30
- Development: ` http://localhost:8000/api/v1 `
31
- - Production: ` https://your-domain.com/api/v1 ` (HTTPS recommended )
31
+ - Production: ` https://your-domain.com/api/v1 ` (Configure with your domain )
32
32
33
33
### HTTPS Configuration
34
34
@@ -38,31 +38,31 @@ For production deployments, HTTPS is strongly recommended. The API supports both
38
38
39
39
1 . ** Interactive Setup** : Run the setup wizard and choose HTTPS options
40
40
``` bash
41
- ./scripts/interactive- setup.sh
42
- # Choose option 2 ( self-signed) or 3 (Let's Encrypt) for SSL configuration
41
+ ./setup.sh --standard
42
+ # Production setup includes HTTPS with self-signed certificates
43
43
```
44
44
45
- 2 . ** Manual Certificate Generation ** :
45
+ 2 . ** Certificate Management ** :
46
46
``` bash
47
- # Self -signed certificate
48
- ./scripts/manage-ssl .sh generate-self-signed your-domain.com
47
+ # Standard setup includes HTTPS with self -signed certificates
48
+ ./setup .sh --standard
49
49
50
- # Let's Encrypt certificate
51
- ./scripts/manage-ssl.sh generate-letsencrypt your-domain.com [email protected]
50
+ # For custom certificates, edit traefik configuration
51
+ # and place certificates in ./traefik/certs/
52
52
```
53
53
54
54
3 . ** Deploy with HTTPS** :
55
55
``` bash
56
- # Production deployment with Traefik (includes HTTPS)
57
- docker compose -f docker compose.prod.yml --profile traefik up -d
56
+ # Production deployment with HTTPS enabled by default
57
+ ./setup.sh --standard
58
58
```
59
59
60
60
#### SSL Certificate Management
61
61
62
- - ** List certificates ** : ` ./scripts/manage-ssl .sh list `
63
- - ** Test SSL setup ** : ` ./scripts/manage-ssl.sh test your-domain.com `
64
- - ** Validate configuration ** : ` ./scripts/manage-ssl.sh validate your-domain.com `
65
- - ** Renew certificates ** : ` ./scripts/manage-ssl.sh renew `
62
+ - ** Check deployment status ** : ` ./setup .sh --status `
63
+ - ** View Traefik logs ** : ` docker compose logs traefik `
64
+ - ** Restart SSL services ** : ` docker compose restart traefik `
65
+ - ** Certificate location ** : ` ./traefik/certs/ `
66
66
67
67
See the [ SSL Management Guide] ( SETUP.md#httpssl-configuration ) for detailed information.
68
68
@@ -519,59 +519,80 @@ curl -X POST http://localhost:8000/api/v1/stream \
519
519
}'
520
520
```
521
521
522
- ## SDKs
522
+ ## API Client Examples
523
523
524
- ### Python SDK
524
+ ### Python Client
525
525
526
526
``` python
527
- from rendiff import RendiffClient
528
-
529
- client = RendiffClient(api_key = " your-api-key" , base_url = " http://localhost:8000" )
530
-
531
- # Simple conversion
532
- job = client.convert(
533
- input = " /storage/input/video.avi" ,
534
- output = " mp4"
535
- )
536
-
537
- # Monitor progress
538
- for progress in job.watch():
539
- print (f " Progress: { progress.percentage} % " )
540
-
541
- # Get result
542
- result = job.wait()
543
- print (f " Output: { result.output_path} " )
544
- ```
545
-
546
- ### JavaScript SDK
527
+ import requests
528
+ import time
529
+
530
+ class FFmpegAPIClient :
531
+ def __init__ (self , api_key , base_url = " http://localhost:8000" ):
532
+ self .api_key = api_key
533
+ self .base_url = base_url
534
+ self .headers = {" X-API-Key" : api_key, " Content-Type" : " application/json" }
535
+
536
+ def convert (self , input_path , output_format ):
537
+ response = requests.post(
538
+ f " { self .base_url} /api/v1/convert " ,
539
+ json = {" input" : input_path, " output" : output_format},
540
+ headers = self .headers
541
+ )
542
+ return response.json()
543
+
544
+ def get_job_status (self , job_id ):
545
+ response = requests.get(
546
+ f " { self .base_url} /api/v1/jobs/ { job_id} " ,
547
+ headers = self .headers
548
+ )
549
+ return response.json()
550
+
551
+ # Usage
552
+ client = FFmpegAPIClient(api_key = " your-api-key" )
553
+ job = client.convert(" /storage/input/video.avi" , " mp4" )
554
+ print (f " Job ID: { job[' job' ][' id' ]} " )
555
+ ```
556
+
557
+ ### JavaScript Client
547
558
548
559
``` javascript
549
- import { RendiffClient } from ' @rendiff/sdk' ;
550
-
551
- const client = new RendiffClient ({
552
- apiKey: ' your-api-key' ,
553
- baseUrl: ' http://localhost:8000'
554
- });
555
-
556
- // Convert with async/await
557
- const job = await client .convert ({
558
- input: ' /storage/input/video.avi' ,
559
- output: ' mp4'
560
- });
561
-
562
- // Watch progress
563
- job .onProgress ((progress ) => {
564
- console .log (` Progress: ${ progress .percentage } %` );
565
- });
560
+ class FFmpegAPIClient {
561
+ constructor (apiKey , baseUrl = ' http://localhost:8000' ) {
562
+ this .apiKey = apiKey;
563
+ this .baseUrl = baseUrl;
564
+ this .headers = {
565
+ ' X-API-Key' : apiKey,
566
+ ' Content-Type' : ' application/json'
567
+ };
568
+ }
569
+
570
+ async convert (input , output ) {
571
+ const response = await fetch (` ${ this .baseUrl } /api/v1/convert` , {
572
+ method: ' POST' ,
573
+ headers: this .headers ,
574
+ body: JSON .stringify ({ input, output })
575
+ });
576
+ return response .json ();
577
+ }
578
+
579
+ async getJobStatus (jobId ) {
580
+ const response = await fetch (` ${ this .baseUrl } /api/v1/jobs/${ jobId} ` , {
581
+ headers: this .headers
582
+ });
583
+ return response .json ();
584
+ }
585
+ }
566
586
567
- // Wait for completion
568
- const result = await job .wait ();
569
- console .log (` Output: ${ result .outputPath } ` );
587
+ // Usage
588
+ const client = new FFmpegAPIClient (' your-api-key' );
589
+ const job = await client .convert (' /storage/input/video.avi' , ' mp4' );
590
+ console .log (` Job ID: ${ job .job .id } ` );
570
591
```
571
592
572
593
### cURL Examples
573
594
574
- See the [ examples directory ] ( ../examples/ ) for more cURL examples and use cases .
595
+ Basic API usage with cURL commands .
575
596
576
597
## Rate Limiting
577
598
@@ -580,7 +601,7 @@ Default rate limits per API key:
580
601
- 1000 requests/hour
581
602
- 10 concurrent jobs
582
603
583
- These can be configured in the KrakenD gateway configuration .
604
+ Rate limits are configurable through environment variables and can be adjusted based on your API key tier .
584
605
585
606
## Webhooks
586
607
@@ -790,5 +811,5 @@ The API automatically redirects HTTP traffic to HTTPS when SSL is enabled.
790
811
791
812
- API Documentation: http://localhost:8000/docs
792
813
- OpenAPI Schema: http://localhost:8000/openapi.json
793
- - GitHub: https ://github.com/rendiffdev/ffmpeg- api
794
- - Discord: https ://discord.gg/rendiff
814
+ - Health Check: http ://localhost:8000/ api/v1/health
815
+ - Metrics: http ://localhost:9090 (if monitoring enabled)
0 commit comments