{"id":22871735,"url":"https://github.com/mattwelke/nodejs-debian-ffmpeg-example","last_synced_at":"2025-12-30T21:46:58.532Z","repository":{"id":266552864,"uuid":"646979960","full_name":"mattwelke/nodejs-debian-ffmpeg-example","owner":"mattwelke","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-29T19:58:17.000Z","size":597,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-06T08:56:34.021Z","etag":null,"topics":["debian","debian-packages","docker","example","ffmpeg","nodejs"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/mattwelke.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-29T19:40:31.000Z","updated_at":"2023-05-29T19:59:06.000Z","dependencies_parsed_at":"2024-12-04T21:26:16.062Z","dependency_job_id":"c8c111d9-ca13-4c06-ac1e-e7f23ca08a8a","html_url":"https://github.com/mattwelke/nodejs-debian-ffmpeg-example","commit_stats":null,"previous_names":["mattwelke/nodejs-debian-ffmpeg-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mattwelke/nodejs-debian-ffmpeg-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattwelke%2Fnodejs-debian-ffmpeg-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattwelke%2Fnodejs-debian-ffmpeg-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattwelke%2Fnodejs-debian-ffmpeg-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattwelke%2Fnodejs-debian-ffmpeg-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattwelke","download_url":"https://codeload.github.com/mattwelke/nodejs-debian-ffmpeg-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattwelke%2Fnodejs-debian-ffmpeg-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270300643,"owners_count":24561344,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["debian","debian-packages","docker","example","ffmpeg","nodejs"],"created_at":"2024-12-13T13:28:33.048Z","updated_at":"2025-12-30T21:46:58.489Z","avatar_url":"https://github.com/mattwelke.png","language":"Shell","readme":"# nodejs-debian-ffmpeg-example\n\nDemonstrates using the [`ffmpeg` Debian package](https://packages.debian.org/buster/ffmpeg)  via the [`ffmpeg` NPM package](https://www.npmjs.com/package/ffmpeg). Uses Docker and a volume mount so that the test can be completed regardless of host OS. It will be the Debian package being used.\n\nThis can be used to help learn Docker concepts and help learn how to package a Node.js application that uses ffmpeg into a container image to be deployed to production using any platform that supports container images.\n\nThe sample input file is `drop.avi`, which comes from https://www.engr.colostate.edu/me/facil/dynamics/avis.htm.\n\n## Running the example\n\n### Without installing Debian dependency\n\nThis demonstrates what happens if you package the Node.js script into a Docker image without installing the Debian dependency.\n\n1. Note that the `videos` directory has one file.\n   \n   ```\n   $ ls -l videos\n   total 660\n   -rw-rw-r-- 1 matt matt 675840 May 29 14:43 drop.avi\n   ```\n\n1. Run `./build.sh \u0026\u0026 ./run.sh`. This builds an image and runs it, while mounting the `videos` directory as a volume and specifying environment variables so that the script uses that directory for its input and output.\n\n   Note the error message displayed.\n   \n   ```\n   Error:  Error: Command failed: ffmpeg -i /videos/drop.avi -s 0x0 /videos/drop_after.avi\n   /bin/sh: 1: ffmpeg: not found\n   \n       at ChildProcess.exithandler (node:child_process:419:12)\n       at ChildProcess.emit (node:events:513:28)\n       at maybeClose (node:internal/child_process:1091:16)\n       at Socket.\u003canonymous\u003e (node:internal/child_process:449:11)\n       at Socket.emit (node:events:513:28)\n       at Pipe.\u003canonymous\u003e (node:net:322:12) {\n     code: 127,\n     killed: false,\n     signal: null,\n     cmd: 'ffmpeg -i /videos/drop.avi -s 0x0 /videos/drop_after.avi'\n   }\n   ```\n\n   This means that the system dependency for the `ffmpeg` NPM package was not satisfied.\n\n1. Note that the `videos` directory still has one file.\n   \n   ```\n   $ ls -l videos\n   total 660\n   -rw-rw-r-- 1 matt matt 675840 May 29 14:43 drop.avi\n   ```\n\n### With installing Debian dependency\n\nThis demonstrates what happens if you package the Node.js script into a Docker image while installing the Debian dependency. The Dockerfile (`Dockerfile.withlibs`) has more lines added to it which include `RUN apt-get -y` commands to install the dependency.\n\n1. Note that the `videos` directory has one file.\n   \n   ```\n   $ ls -l videos\n   total 660\n   -rw-rw-r-- 1 matt matt 675840 May 29 14:43 drop.avi\n   ```\n\n1. Run `./build_withlibs.sh \u0026\u0026 ./run_withlibs.sh`. This builds an image and runs it, while mounting the `videos` directory as a volume and specifying environment variables so that the script uses that directory for its input and output. Unlike the above steps, these scripts build the image using the Dockerfile that includes the step to install the Debian dependency.\n\n   Note the lack of error message displayed. This means the Node.js script (`index.js`) was able to complete without encountering any errors. This means the `ffmpeg` NPM package was able to use the binaries provided by the `ffmpeg` Debian package to do what it needs to do.\n\n1. Note that the `videos` directory now has two files. The Docker container outputted the processed video file to this directory. Note that the `drop_after.avi` file is smaller, showing that the resize was successful.\n\n   ```\n   $ ls -l videos\n   total 872\n   -rw-r--r-- 1 root root 214742 May 29 15:47 drop_after.avi\n   -rw-rw-r-- 1 matt matt 675840 May 29 14:43 drop.avi\n   ```\n\n### Interactive\n\n The `run_interactive.sh` and `run_withlibs_interactive.sh` scripts allow you to get a shell into the running container instead of having the container perform its work using the Node.js script.\n\n```\n$ ./run_withlibs_interactive.sh \nroot@922eeeb64018:/usr/src/app#\n```\n\n1. You can see which files were included in the built Docker image.\n   \n   ```\n   $ ./run_withlibs_interactive.sh \n   root@922eeeb64018:/usr/src/app# ls\n   Dockerfile           build.sh           node_modules       run.sh              run_withlibs_interactive.sh\n   Dockerfile_withlibs  build_withlibs.sh  package-lock.json  run_interactive.sh\n   README.md            index.js           package.json       run_withlibs.sh\n   ```\n\n1. You can see whether the `videos` directory was successfully mounted and which files are accessible from within the container (aka which files are accessible by the Node.js script).\n\n   ```\n   root@922eeeb64018:/usr/src/app# ls /videos\n   drop.avi\n   ```\n\n## Reference\n\n* https://wiki.debian.org/ffmpeg\n* https://nodejs.org/en/docs/guides/nodejs-docker-webapp\n* https://pythonspeed.com/articles/system-packages-docker/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattwelke%2Fnodejs-debian-ffmpeg-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattwelke%2Fnodejs-debian-ffmpeg-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattwelke%2Fnodejs-debian-ffmpeg-example/lists"}