{"id":17972599,"url":"https://github.com/kevingodell/pipe2pam","last_synced_at":"2025-03-25T12:33:10.165Z","repository":{"id":57324743,"uuid":"85637186","full_name":"kevinGodell/pipe2pam","owner":"kevinGodell","description":"Parse individual pam images from an ffmpeg pipe when output video codec(-c:v) is set to pam and format(-f) is set to image2pipe. Pam is an image type similar to ppm, pbm, and pgm. It has a small header that is followed by an uncompressed array of pixel data.","archived":false,"fork":false,"pushed_at":"2023-08-09T01:36:05.000Z","size":217,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T03:48:14.425Z","etag":null,"topics":["ffmpeg","image2pipe","nodejs","pam"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/pipe2pam","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevinGodell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-03-20T23:23:01.000Z","updated_at":"2022-07-24T18:18:00.000Z","dependencies_parsed_at":"2024-06-18T20:14:40.325Z","dependency_job_id":null,"html_url":"https://github.com/kevinGodell/pipe2pam","commit_stats":{"total_commits":151,"total_committers":3,"mean_commits":"50.333333333333336","dds":"0.019867549668874163","last_synced_commit":"22fe0befac5066eed13c1cfb17204743c9255322"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinGodell%2Fpipe2pam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinGodell%2Fpipe2pam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinGodell%2Fpipe2pam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinGodell%2Fpipe2pam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinGodell","download_url":"https://codeload.github.com/kevinGodell/pipe2pam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245463013,"owners_count":20619596,"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","image2pipe","nodejs","pam"],"created_at":"2024-10-29T16:23:44.323Z","updated_at":"2025-03-25T12:33:09.643Z","avatar_url":"https://github.com/kevinGodell.png","language":"JavaScript","funding_links":["https://buymeacoffee.com/kevinGodell","https://www.paypal.com/donate/?business=HTMERJAFHJJEU\u0026no_recurring=0\u0026item_name=support+open+source+software+development\u0026currency_code=USD"],"categories":[],"sub_categories":[],"readme":"# pipe2pam\n###### [![Buy me a coffee](https://img.shields.io/badge/-buy%20me%20a%20coffee-red?logo=buy%20me%20a%20coffee)](https://buymeacoffee.com/kevinGodell) [![Donate via PayPal](https://img.shields.io/badge/Donate-Paypal-blue)](https://www.paypal.com/donate/?business=HTMERJAFHJJEU\u0026no_recurring=0\u0026item_name=support+open+source+software+development\u0026currency_code=USD) [![build](https://github.com/kevinGodell/pipe2pam/actions/workflows/node.js.yml/badge.svg)](https://github.com/kevinGodell/pipe2pam/actions/workflows/node.js.yml) [![Build status](https://ci.appveyor.com/api/projects/status/v29p3vhykt756hvc/branch/master?svg=true)](https://ci.appveyor.com/project/kevinGodell/pipe2pam/branch/master) [![GitHub issues](https://img.shields.io/github/issues/kevinGodell/pipe2pam.svg)](https://github.com/kevinGodell/pipe2pam/issues) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/kevinGodell/pipe2pam/master/LICENSE) [![npm](https://img.shields.io/npm/dt/pipe2pam.svg?style=flat-square)](https://www.npmjs.com/package/pipe2pam)\nParse individual pam images from an ffmpeg pipe when the output video codec (*-c:v*) is set to **pam** and the format (*-f*) is set to **image2pipe**. The supported pixel formats (*-pix_fmt*) are **rgb24**, **rgba**, **gray**, and **monob**. Pam is an image type similar to ppm, pbm, and pgm. It has a small header that is followed by an uncompressed array of pixel data. This can be used as an alternate way to get pixel data instead of generating jpegs and using canvas. It is currently being used for a video motion detection project.\n### installation:\n```\nnpm install pipe2pam --save\n```\n### usage:\nThe following [example](https://github.com/kevinGodell/pipe2pam/blob/master/examples/example.js) uses ffmpeg's **testsrc** to simulate a video input and generates 100 downscaled grayscale pam images at a rate of 1 per second. The pam images are piped in from ffmpeg's stdout and output a pam image object. Pipe2Pam dispatches a \"data\" event, which contains a pam image object. The object contains the entire pam image, plus additional data such as width, height, depth, maxval, tupltype, and an array of pixels. It can also pipe the object to a [pipe reader](https://github.com/kevinGodell/pam-diff) for further use, such as pixel comparison between 2 pam images:\n```javascript\nconst Pipe2Pam = require('pipe2pam');\n\nconst { spawn } = require('child_process');\n\nlet counter = 0;\n\nconst params = [\n    '-loglevel',\n    'quiet',\n    '-re',\n    '-f',\n    'lavfi',\n    '-i',\n    'testsrc=size=1920x1080:rate=15',\n    '-an',\n    '-c:v',\n    'pam',\n    '-f',\n    'image2pipe',\n    '-pix_fmt',\n    //'rgb24',\n    //'rgba',\n    'gray',\n    //'monob',\n    '-vf',\n    'fps=1,scale=iw*1/6:ih*1/6',\n    '-frames',\n    '100',\n    'pipe:1'\n];\n\nconst pipe2pam = new Pipe2Pam();\n\npipe2pam.on('data', (data) =\u003e {\n    console.log(data);\n    console.log('received pam', ++counter);\n});\n\nconst ffmpeg = spawn('ffmpeg', params);\n\nffmpeg.on('error', (error) =\u003e {\n    console.log(error);\n});\n\nffmpeg.on('exit', (code, signal) =\u003e {\n    console.log('exit', code, signal);\n});\n\nffmpeg.stdout.pipe(pipe2pam);\n```\n### testing:\nClone the repository\n```\ngit clone https://github.com/kevinGodell/pipe2pam.git\n```\nChange into the directory\n```\ncd pipe2pam\n```\nInitialize with npm\n```\nnpm install\n```\nStart the tests\n```\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevingodell%2Fpipe2pam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevingodell%2Fpipe2pam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevingodell%2Fpipe2pam/lists"}