{"slug": "inspect-a-local-mp4-with-node-js-without-calling-a-model-api", "title": "Inspect a Local MP4 with Node.js Without Calling a Model API", "summary": "A developer published a Node.js utility that inspects a local MP4 file using the standard library and an installed ffprobe binary, reporting duration, video stream dimensions, codec, and audio stream count without calling any model API or uploading media. The script, run as `node inspect-video.mjs ./clip.mp4`, returns exit status 2 for missing arguments and a nonzero status for failed reads or absent video streams, and in a test on a headphone clip reported H.264 video at 832×464, a 5.0625-second duration, and zero audio streams.", "body_md": "A small media-review utility can answer basic questions before you open a video: does it contain a video stream, what dimensions does it report, how long is it, and is there an audio stream? You can collect those fields with Node's standard library and an installed ffprobe binary.\n\nGemini assisted this draft and the example was checked locally. The team preparing it also works on ReelBoop; this article is a technical inspection example, with no sales call to action.\n\nUse Node.js 18 or later with ffprobe already on PATH. Save the following as `inspect-video.mjs`:\n\n``` js\nimport {execFileSync} from 'node:child_process';\nimport {resolve} from 'node:path';\n\nconst input = process.argv[2];\nif (!input) {\n  console.error('Usage: node inspect-video.mjs <local-video>');\n  process.exit(2);\n}\n\ntry {\n  const data = JSON.parse(execFileSync('ffprobe', [\n    '-v', 'error',\n    '-show_entries',\n    'format=duration,size:stream=codec_type,codec_name,width,height',\n    '-of', 'json', resolve(input)\n  ], {encoding: 'utf8', maxBuffer: 1024 * 1024}));\n\n  const video = (data.streams || []).filter(s => s.codec_type === 'video');\n  if (!video.length) throw new Error('No video stream found');\n  console.log(JSON.stringify({\n    durationSeconds: Number(data.format?.duration),\n    video,\n    audioStreams: (data.streams || []).filter(s => s.codec_type === 'audio').length\n  }, null, 2));\n} catch (error) {\n  console.error('Inspection failed:', error.message);\n  process.exit(1);\n}\n```\n\nRun `node inspect-video.mjs ./clip.mp4`. The program receives a filename as an argument and resolves it as a local path. Passing arguments as an array avoids shell interpolation of characters in the filename. That does not make arbitrary media processing universally safe: keep ffprobe updated and consider process isolation for untrusted files in a production service.\n\nThe wrapper makes no model request and does not upload media. Missing arguments return exit status 2. A failed read or absence of video returns a nonzero status, allowing a caller to keep that case separate from a successful report.\n\nFor the existing headphone example used while checking this utility, the report contained H.264 video at 832×464, a duration of 5.0625 seconds and zero audio streams. The zero counts streams in that file; it does not mean that the script removed sound.\n\nA readable metadata report does not prove the full file decodes correctly or plays in every browser. Test playback separately. Likewise, frame dimensions do not establish whether the content fits a social platform's current requirements. Keep your destination checks explicit rather than giving every file a generic “passed” status.\n\nIf a duration or another required field is missing, validate it separately before relying on it. JSON can serialize a non-finite numeric conversion as null; do not confuse that with a real zero-second measurement.\n\nFor generated product clips, use another record for geometry, component count, lettering, color and unexpected objects. Compare the original still with the beginning, middle and end, and watch the entire sequence. A technically readable file can still show a bent handle or changing label.\n\nIn the headphone example, the view turns and the inner cushions become more visible, while apparent cup spacing changes. No codec or duration check identifies whether that is acceptable for a particular product listing. That is a separate judgment about intended use, not a media-parser result.\n\nThese two reports answer different questions: what file you received, and whether its visual content is suitable. Keep them distinct in the interface and in any approval process.", "url": "https://wpnews.pro/news/inspect-a-local-mp4-with-node-js-without-calling-a-model-api", "canonical_source": "https://dev.to/davidyangplus/inspect-a-local-mp4-with-nodejs-without-calling-a-model-api-4con", "published_at": "2026-10-16 15:38:20+00:00", "updated_at": "2026-10-16 15:47:52.300172+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Node.js", "ffprobe", "ReelBoop", "Gemini"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/inspect-a-local-mp4-with-node-js-without-calling-a-model-api", "markdown": "https://wpnews.pro/news/inspect-a-local-mp4-with-node-js-without-calling-a-model-api.md", "text": "https://wpnews.pro/news/inspect-a-local-mp4-with-node-js-without-calling-a-model-api.txt", "jsonld": "https://wpnews.pro/news/inspect-a-local-mp4-with-node-js-without-calling-a-model-api.jsonld"}}