Juq-968-engsub Convert02-23-49 Min Fixed Review
ffmpeg -i "JUQ-968‑engsub.mkv" \ -c:v libx264 -preset slow -crf 22 \ # re‑encode video (adjust CRF for quality/size) -c:a aac -b:a 192k \ # re‑encode audio to AAC (MP4‑compatible) -c:s mov_text \ # convert subtitle to MP4‑friendly format -metadata:s:s:0 language=eng \ # label subtitle track "JUQ-968‑converted.mp4"
| Layer | Details | |-------|---------| | | React (v18) functional component EngSubConvert . Uses react-dropzone for uploads, Formik for form validation, and axios for API calls. Shows real‑time progress via Server‑Sent Events (SSE) or WebSocket (fallback to polling). | | Back‑end | Node.js (>=18) + Express. Endpoint: POST /api/engsub/convert . Accepts multipart/form-data . Uses multer for temporary storage (in /tmp/juq968 ). | | Processing Engine | - Parsing : subtitle npm library (supports SRT/VTT/ASS). - Time‑shift : Convert timestamps to seconds, apply offset (signed integer), clamp to ≥ 0, re‑format. - Conversion : Same library’s toVtt() , toAss() , toSrt() . - Batch : Process files sequentially in a worker pool (max 4 concurrent). | | ZIP Generation | archiver library streams output directly to response (no intermediate large buffers). | | Log Generation | Build an array of fileName, originalStart, newStart rows; stream to CSV via fast-csv . | | Security | - Validate MIME type and extension. - Size limit: 10 MB per file, 100 MB total per request. - Delete temp files after response ( fs.unlink ). | | Performance | - Expected processing time: ~0.15 s per file (10 MB). - Memory footprint ≤ 50 MB for 100 files. | | Testing | - Unit tests for timestamp conversion (edge cases: midnight roll‑over, negative clamp). - Integration tests for multipart upload, ZIP download, log correctness. - End‑to‑end Cypress test covering UI flow. | | Observability | - Log start/end timestamps, file counts, errors to CloudWatch (or equivalent). - Metrics: juq968_requests_total , juq968_processing_seconds . | JUQ-968-engsub Convert02-23-49 Min