Качество
@@ -900,6 +910,7 @@
initBtnGroup('convertFormats', val => { state.format = val; });
initBtnGroup('audioFormats', val => { state.audioFormat = val; });
+ initBtnGroup('compressFormats', val => { state.compressFormat = val; });
// ─── Quality options ───────────────────────────────────────────────────────
document.querySelectorAll('.quality-option').forEach(label => {
@@ -926,7 +937,8 @@
const body = {
jobId: state.jobId,
mode: state.mode,
- format: state.mode === 'convert' ? state.format
+ format: state.mode === 'compress' ? (state.compressFormat || 'mp4')
+ : state.mode === 'convert' ? state.format
: state.mode === 'audio' ? state.audioFormat
: state.mode === 'gif' ? 'gif'
: 'mp4',
diff --git a/routes/video.js b/routes/video.js
index b822c85..5daeecc 100644
--- a/routes/video.js
+++ b/routes/video.js
@@ -169,9 +169,10 @@ router.post('/convert', express.json(), async (req, res) => {
break;
}
case 'compress': {
- // Quality via mpeg4 q:v (1=best, 31=worst)
+ // Quality via mpeg4 q:v (1=best, 31=worst) + format selection
const qv = quality === 'high' ? '3' : quality === 'low' ? '15' : '8';
- args.push('-c:v', 'mpeg4', '-q:v', qv, '-c:a', 'aac', '-b:a', '128k', '-movflags', '+faststart');
+ args.push('-c:v', 'mpeg4', '-q:v', qv, '-c:a', 'aac', '-b:a', '128k');
+ if (format === 'mp4' || !format) args.push('-movflags', '+faststart');
break;
}
case 'audio': {