{"id":13905551,"url":"https://github.com/danielsobrado/ffmpeg-s3","last_synced_at":"2026-05-04T00:37:18.806Z","repository":{"id":218012734,"uuid":"617102515","full_name":"danielsobrado/ffmpeg-s3","owner":"danielsobrado","description":"Execute FFMPEG processes on S3 buckets","archived":false,"fork":false,"pushed_at":"2023-03-24T20:47:17.000Z","size":21,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-07T23:43:41.769Z","etag":null,"topics":["ffmpeg","java","minio"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielsobrado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-03-21T17:50:04.000Z","updated_at":"2024-01-17T21:36:14.000Z","dependencies_parsed_at":"2024-01-19T09:44:16.124Z","dependency_job_id":"f5bacc2a-4016-4ded-af09-e0da118c3039","html_url":"https://github.com/danielsobrado/ffmpeg-s3","commit_stats":null,"previous_names":["danielsobrado/ffmpeg-s3"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsobrado%2Fffmpeg-s3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsobrado%2Fffmpeg-s3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsobrado%2Fffmpeg-s3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsobrado%2Fffmpeg-s3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielsobrado","download_url":"https://codeload.github.com/danielsobrado/ffmpeg-s3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226336574,"owners_count":17608860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ffmpeg","java","minio"],"created_at":"2024-08-06T23:01:18.385Z","updated_at":"2026-05-04T00:37:18.503Z","avatar_url":"https://github.com/danielsobrado.png","language":"Java","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# FFmpeg File Conversion on S3 buckets\n\nThis is a project using FFmpeg to convert files from one format to another. The project reads and saves files to a Minio instance running in a Docker container.\n\n## Prerequisites\n\n- Java 17\n- Gradle\n- Docker\n- Docker Compose\n- Minio\n- FFmpeg installed and accessible in system's `PATH`\n\n## Setup\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/danielsobrado/ffmpeg-s3.git\ncd ffmpeg-s3\n```\nBuild and run the project with Docker Compose:\n\n```bash\ndocker-compose up --build\n```\n\nThe Java application will be accessible at http://localhost:8080, and the Minio instance will be accessible at http://localhost:9000.\n\n## Usage\nThe application exposes an API for file conversion. Send a POST request with the required parameters to the /convert endpoint to start a file conversion:\n\n```bash\ncurl -X POST \"http://localhost:8080/convert\" \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\n           \"inputBucket\": \"input-bucket\",\n           \"outputBucket\": \"output-bucket\",\n           \"inputFileKey\": \"path/to/input/file\",\n           \"outputFileKey\": \"path/to/output/file\",\n           \"inputFormat\": \"avi\",\n           \"outputFormat\": \"mp4\"\n         }'\n```\nReplace the placeholders with the appropriate Minio bucket names, object keys, and file formats.\n\n## Using a RAM Disk for Temporary File Storage\n\nBy default, the application stores temporary files on disk during the file conversion process. To minimize the overhead of reading and writing files to disk, you can use a RAM disk as the temporary file storage.\n\n### Creating a RAM Disk on Linux\n\nTo create a RAM disk on Linux, run the following commands:\n\n```bash\nsudo mkdir /mnt/ramdisk\nsudo mount -t tmpfs -o size=1G tmpfs /mnt/ramdisk\n```\nThis creates a RAM disk with a size of 1 GB mounted at `/mnt/ramdisk`. You can adjust the size according to your requirements.\n\n## Configuring the Application to Use the RAM Disk\nUpdate the tempDir property in your application.yml file to point to the RAM disk:\n\n```\ntempDir: /mnt/ramdisk\n```\n\nKeep in mind that using a RAM disk will consume memory, so ensure your system has enough free RAM to accommodate the disk size and other running processes.\n\n## Signed URLs with MinIO and FFmpeg Integration\n\nSigned URLs are a secure and convenient way to provide temporary access to objects in a MinIO bucket. Using signed URLs, you can grant limited-time access to download or upload objects without sharing your MinIO credentials.\n\n### How Signed URLs Work in MinIO\n\nMinIO allows you to generate signed URLs using the `getPresignedObjectUrl` method. You can specify the HTTP method (GET, PUT, DELETE), the bucket, the object key, and the expiration time for the URL.\n\nWhen a user accesses the signed URL, MinIO checks if the URL is still valid (not expired) and if the requested operation (GET, PUT, DELETE) is allowed. If the conditions are met, MinIO performs the operation without requiring any additional authentication.\n\n### Integrating Signed URLs with FFmpeg\n\nIntegrating signed URLs with FFmpeg allows you to directly download and upload files to and from MinIO buckets for processing. This eliminates the need to store intermediate files on your server, reducing storage requirements and improving performance.\n\nTo integrate signed URLs with FFmpeg:\n\n1. **Generate a signed URL for downloading the input file:** Create a signed URL using the `getPresignedObjectUrl` method with the GET method, input bucket, and input object key.\n\n```java\nString inputUrl = minioClient.getPresignedObjectUrl(\n        GetPresignedObjectUrlArgs.builder()\n        .method(Method.GET)\n        .bucket(inputBucket)\n        .object(inputFileKey)\n        .expiry(1, TimeUnit.HOURS)\n        .build()\n        );\n```\n\n2. **Generate a signed URL for uploading the output file:** Create a signed URL using the `getPresignedObjectUrl` method with the PUT method, output bucket, and output object key.\n\n```java\nString outputUrl = minioClient.getPresignedObjectUrl( \n        GetPresignedObjectUrlArgs.builder() \n        .method(Method.PUT) \n        .bucket(outputBucket) \n        .object(outputFileKey)\n        .expiry(1, TimeUnit.HOURS)\n        .build() \n        );\n```\n\n3. **Use FFmpeg with the signed URLs:** Execute FFmpeg commands using the signed URLs as input and output, allowing FFmpeg to download the input file directly from the MinIO bucket and upload the output file without the need for intermediate storage.\n\n`ffmpeg -i \"inputUrl\" -c:v libx264 -preset medium -crf 23 \"outputUrl\"`\n\nBy using signed URLs with FFmpeg, you can securely and efficiently process video files directly in your MinIO storage environment.\n\n## Testing\nRun the tests for the project with the following command:\n\n```bash\n./gradlew test\n```\n\n## License\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielsobrado%2Fffmpeg-s3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielsobrado%2Fffmpeg-s3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielsobrado%2Fffmpeg-s3/lists"}