diff --git a/README.md b/README.md index ae942a47..2773b369 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,7 @@ Two caveats worth stating plainly, since "everything is local" is the headline c - **GIF Maker**: Turn a series of images into an animated GIF. Reorder frames, set speed, loop, and resize. - **Subtitle Studio**: Transcribe a video into word-timed subtitles with an on-device Whisper model, style the captions, and burn them into your video. - **Video to Audio**: Extract audio from videos in your browser — MP3, M4A, OGG, or WAV out, with batch conversion, bitrate control, and optional trimming. +- **Video Converter**: Convert videos between MP4, WebM, MKV, AVI, MOV, and GIF in your browser — choose resolution, quality, and audio, trim a range, and watch live progress with cancel. ### 📝 Text & Language Tools diff --git a/e2e/tool-routes.json b/e2e/tool-routes.json index 0aea97f2..fe0e5532 100644 --- a/e2e/tool-routes.json +++ b/e2e/tool-routes.json @@ -223,6 +223,14 @@ "name": "Subtitle Studio", "href": "/tools/subtitle-studio" }, + { + "name": "Video to Audio", + "href": "/tools/video-to-audio" + }, + { + "name": "Video Converter", + "href": "/tools/video-converter" + }, { "name": "Mic Test", "href": "/tools/mic-test" @@ -519,6 +527,10 @@ "name": "Text Encryption", "href": "/tools/text-encryption" }, + { + "name": "TOTP Generator", + "href": "/tools/totp-generator" + }, { "name": "CSS clip-path Generator", "href": "/tools/clip-path-generator" diff --git a/messages/ar.json b/messages/ar.json index 20b7d82b..ef1863b3 100644 --- a/messages/ar.json +++ b/messages/ar.json @@ -792,6 +792,10 @@ "name": "فيديو إلى صوت", "description": "استخرج الصوت من الفيديوهات مباشرة في متصفحك — MP4 وMOV وMKV وAVI وWebM كمدخلات، وMP3 وM4A وOGG وWAV كمخرجات. حوّل عدة ملفات دفعة واحدة، واختر معدل البت، ويمكنك القصّ اختيارياً. بلا رفع ملفات." }, + "video-converter": { + "name": "محوّل الفيديو", + "description": "حوّل الفيديو بين MP4 وWebM وMKV وAVI وMOV وGIF داخل متصفحك. اختر الدقة والجودة والصوت، قصّ نطاقًا زمنيًا، وتابع التقدم مباشرة مع إمكانية الإلغاء. بلا رفع." + }, "wheel-of-names": { "name": "عجلة الأسماء", "description": "أدر عجلة قابلة للتخصيص لاختيار فائز عشوائي من قائمة أسماء. الصق كل اسم في سطر مستقل، بدّل ترتيب الأسماء، ويمكنك حذف كل فائز تلقائياً بعد اختياره." @@ -4181,6 +4185,57 @@ "download": "تنزيل", "emptyQueueHint": "ستظهر الملفات التي تضيفها هنا." }, + "VideoConverter": { + "dropVideoHere": "أفلت الفيديو هنا", + "supportedFormats": "MP4 وMOV وMKV وAVI وWebM وFLV وWMV وM4V وTS — حتى 500 ميغابايت", + "change": "تغيير", + "videoTooLarge": "حجم الفيديو يجب أن يكون أقل من 500 ميغابايت", + "settings": "إعدادات التحويل", + "outputFormat": "صيغة الخرج", + "format_mp4": "MP4 ‏(H.264 / AAC)", + "format_webm": "WebM ‏(VP9 / Opus)", + "format_mkv": "MKV ‏(H.264 / AAC)", + "format_avi": "AVI ‏(MPEG-4 / MP3)", + "format_gif": "GIF ‏(متحركة، بلا صوت)", + "format_mov": "MOV ‏(H.264 / AAC)", + "quality": "الجودة", + "quality_high": "عالية", + "quality_medium": "متوسطة", + "quality_low": "منخفضة", + "resolution": "الدقة", + "resolutionOriginal": "الأصلية", + "audio": "الصوت", + "audio_keep": "الإبقاء على الصوت", + "audio_bitrate": "إعادة الترميز بمعدل بت محدد", + "audio_strip": "إزالة الصوت", + "gifNoAudio": "صيغة GIF لا تحتوي على مسار صوتي.", + "bitrate": "معدل بت الصوت", + "trimStart": "بداية القصّ", + "trimEnd": "نهاية القصّ", + "trimPlaceholder": "mm:ss", + "trimHint": "اختياري. اترك الحقلين فارغين لتحويل الفيديو كاملًا.", + "invalidTrim": "قيم القصّ غير صالحة — تأكد من الأوقات (يجب أن تسبق البداية النهاية).", + "convert": "تحويل", + "converting": "جارٍ التحويل…", + "cancel": "إلغاء", + "cancelling": "جارٍ الإلغاء…", + "cancelled": "تم إلغاء التحويل.", + "convertingPlaceholder": "سيظهر الفيديو المحوَّل هنا عند الانتهاء", + "outputPlaceholder": "سيظهر الفيديو المحوَّل هنا", + "previewUnavailable": "لا يمكن معاينة هذه الصيغة في المتصفح — نزّلها لتشغيلها.", + "inputPreviewUnavailable": "لا يستطيع المتصفح تشغيل هذه الصيغة، لكن يمكن تحويلها.", + "speed": "السرعة", + "eta": "الوقت المتبقي", + "elapsed": "الوقت المنقضي", + "calculating": "جارٍ الحساب…", + "originalSize": "الحجم الأصلي", + "outputSize": "الحجم بعد التحويل", + "sizeChange": "تغيّر الحجم", + "convertSuccess": "تم تحويل الفيديو بنجاح!", + "convertFailed": "فشل تحويل الفيديو. جرّب صيغة أخرى أو نطاق قصّ أقصر.", + "engineLoadFailed": "تعذّر تحميل محرك التحويل. تحقق من اتصالك وحاول مجددًا.", + "downloadedSuccess": "تم تنزيل الفيديو!" + }, "CurlConverter": { "selectLanguage": "اختر اللغة", "langFetch": "JavaScript ‏(fetch)", diff --git a/messages/de.json b/messages/de.json index 867e2932..7509b227 100644 --- a/messages/de.json +++ b/messages/de.json @@ -784,6 +784,10 @@ "name": "Video zu Audio", "description": "Extrahiere Audio aus Videos direkt im Browser — MP4, MOV, MKV, AVI oder WebM als Eingabe, MP3, M4A, OGG oder WAV als Ausgabe. Konvertiere im Batch, wähle die Bitrate und schneide bei Bedarf zu. Kein Datei-Upload." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "Namensrad", "description": "Drehe ein anpassbares Glücksrad, um zufällig einen Gewinner aus einer Namensliste zu ziehen. Ein Name pro Zeile, Reihenfolge mischen und Gewinner nach der Ziehung optional entfernen." @@ -4133,6 +4137,57 @@ "download": "Herunterladen", "emptyQueueHint": "Hinzugefügte Dateien erscheinen hier." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Sprache auswählen", "langFetch": "JavaScript (fetch)", diff --git a/messages/en.json b/messages/en.json index 454c08a9..760bb715 100644 --- a/messages/en.json +++ b/messages/en.json @@ -792,6 +792,10 @@ "name": "Video to Audio", "description": "Extract audio from videos in your browser — MP4, MOV, MKV, AVI or WebM in, MP3, M4A, OGG or WAV out. Batch convert, pick the bitrate, optionally trim. No uploads." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "Wheel of Names", "description": "Spin a customizable wheel to randomly pick a winner from a list of names. Paste one name per line, shuffle the order, and optionally remove each winner after they're picked." @@ -4181,6 +4185,57 @@ "download": "Download", "emptyQueueHint": "Files you add will appear here." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Select language", "langFetch": "JavaScript (fetch)", diff --git a/messages/es.json b/messages/es.json index a6319a18..3343f71e 100644 --- a/messages/es.json +++ b/messages/es.json @@ -784,6 +784,10 @@ "name": "Video a audio", "description": "Extrae el audio de tus videos directamente en el navegador — MP4, MOV, MKV, AVI o WebM de entrada, MP3, M4A, OGG o WAV de salida. Convierte en lote, elige la tasa de bits y recorta si lo necesitas. Sin subir archivos." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "Ruleta de nombres", "description": "Gira una ruleta personalizable para elegir al azar un ganador de una lista de nombres. Pega un nombre por línea, mezcla el orden y, si quieres, elimina a cada ganador tras el sorteo." @@ -4133,6 +4137,57 @@ "download": "Descargar", "emptyQueueHint": "Los archivos que añadas aparecerán aquí." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Selecciona el lenguaje", "langFetch": "JavaScript (fetch)", diff --git a/messages/fa.json b/messages/fa.json index ba1012bd..16b9a53f 100644 --- a/messages/fa.json +++ b/messages/fa.json @@ -788,6 +788,10 @@ "name": "تبدیل ویدیو به صوت", "description": "صدای ویدیوها را در مرورگر استخراج کنید — ورودی MP4، MOV، MKV، AVI یا WebM و خروجی MP3، M4A، OGG یا WAV. تبدیل گروهی، انتخاب بیت‌ریت و برش دلخواه. بدون آپلود." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "گردونه اسامی", "description": "گردونه‌ای سفارشی را بچرخانید تا برنده‌ای تصادفی از فهرست اسامی انتخاب شود. هر نام را در یک خط جای‌گذاری کنید، ترتیب را به‌هم بزنید و در صورت تمایل هر برنده را پس از انتخاب حذف کنید." @@ -4177,6 +4181,57 @@ "download": "دانلود", "emptyQueueHint": "فایل‌هایی که اضافه کنید اینجا نمایش داده می‌شوند." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "انتخاب زبان", "langFetch": "JavaScript (fetch)", diff --git a/messages/fr.json b/messages/fr.json index cce5e32c..674f1803 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -784,6 +784,10 @@ "name": "Vidéo vers audio", "description": "Extrayez l'audio de vos vidéos directement dans le navigateur — MP4, MOV, MKV, AVI ou WebM en entrée, MP3, M4A, OGG ou WAV en sortie. Convertissez en lot, choisissez le débit binaire et rognez si besoin. Aucun envoi de fichier." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "Roue des noms", "description": "Faites tourner une roue personnalisable pour tirer au sort un gagnant dans une liste de noms. Collez un nom par ligne, mélangez l'ordre et retirez chaque gagnant après son tirage si vous le souhaitez." @@ -4133,6 +4137,57 @@ "download": "Télécharger", "emptyQueueHint": "Les fichiers que vous ajoutez apparaîtront ici." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Sélectionner un langage", "langFetch": "JavaScript (fetch)", diff --git a/messages/hi.json b/messages/hi.json index 4fe53c29..471fd553 100644 --- a/messages/hi.json +++ b/messages/hi.json @@ -788,6 +788,10 @@ "name": "वीडियो से ऑडियो", "description": "ब्राउज़र में वीडियो से ऑडियो निकालें — MP4, MOV, MKV, AVI या WebM से MP3, M4A, OGG या WAV। बैच कन्वर्ट, बिटरेट चुनें, चाहें तो ट्रिम करें। कोई अपलोड नहीं।" }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "नामों का पहिया", "description": "नामों की लिस्ट से रैंडम विजेता चुनने के लिए पहिया घुमाएँ। हर लाइन में एक नाम पेस्ट करें, क्रम बदलें, और चाहें तो हर विजेता को चुनने के बाद हटा दें।" @@ -4177,6 +4181,57 @@ "download": "डाउनलोड करें", "emptyQueueHint": "आप जो फ़ाइलें जोड़ेंगे, वे यहाँ दिखेंगी।" }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "भाषा चुनें", "langFetch": "JavaScript (fetch)", diff --git a/messages/id.json b/messages/id.json index 54524cfb..8ef376ab 100644 --- a/messages/id.json +++ b/messages/id.json @@ -784,6 +784,10 @@ "name": "Video ke Audio", "description": "Ekstrak audio dari video langsung di browser Anda — MP4, MOV, MKV, AVI, atau WebM sebagai input, MP3, M4A, OGG, atau WAV sebagai output. Konversi banyak berkas sekaligus, pilih bitrate, dan potong jika perlu. Tanpa unggah berkas." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "Roda Nama", "description": "Putar roda yang bisa disesuaikan untuk memilih pemenang secara acak dari daftar nama. Tempel satu nama per baris, acak urutannya, dan opsional hapus setiap pemenang setelah terpilih." @@ -4133,6 +4137,57 @@ "download": "Unduh", "emptyQueueHint": "Berkas yang Anda tambahkan akan muncul di sini." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Pilih bahasa", "langFetch": "JavaScript (fetch)", diff --git a/messages/it.json b/messages/it.json index 4dadf3e6..5521689f 100644 --- a/messages/it.json +++ b/messages/it.json @@ -788,6 +788,10 @@ "name": "Da video ad audio", "description": "Estrai l'audio dai video direttamente nel browser — MP4, MOV, MKV, AVI o WebM in ingresso, MP3, M4A, OGG o WAV in uscita. Conversione in batch, scelta del bitrate, taglio opzionale. Nessun caricamento." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "Ruota dei nomi", "description": "Fai girare una ruota personalizzabile per estrarre a caso un vincitore da un elenco di nomi. Incolla un nome per riga, mescola l'ordine e, volendo, rimuovi ogni vincitore dopo l'estrazione." @@ -4177,6 +4181,57 @@ "download": "Scarica", "emptyQueueHint": "I file aggiunti appariranno qui." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Seleziona il linguaggio", "langFetch": "JavaScript (fetch)", diff --git a/messages/ja.json b/messages/ja.json index 54ad30f9..ef4a76c1 100644 --- a/messages/ja.json +++ b/messages/ja.json @@ -788,6 +788,10 @@ "name": "動画から音声を抽出", "description": "ブラウザで動画から音声を取り出します。MP4・MOV・MKV・AVI・WebMを読み込み、MP3・M4A・OGG・WAVで出力。一括変換、ビットレート指定、必要に応じた切り出しに対応し、アップロードはありません。" }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "ルーレット抽選", "description": "名前のリストからルーレットで当選者をランダムに選びます。1行に1名ずつ貼り付け、順番のシャッフルや、当選者を選出後に外す設定もできます。" @@ -4177,6 +4181,57 @@ "download": "ダウンロード", "emptyQueueHint": "追加したファイルがここに表示されます。" }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "言語を選択", "langFetch": "JavaScript(fetch)", diff --git a/messages/ko.json b/messages/ko.json index 7d9f65fe..1fe7f61e 100644 --- a/messages/ko.json +++ b/messages/ko.json @@ -788,6 +788,10 @@ "name": "동영상 → 오디오 추출", "description": "브라우저에서 동영상의 오디오를 추출합니다. MP4, MOV, MKV, AVI, WebM을 넣으면 MP3, M4A, OGG, WAV로 나옵니다. 일괄 변환, 비트레이트 선택, 구간 자르기를 지원하며 업로드는 없습니다." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "이름 뽑기 룰렛", "description": "룰렛을 돌려 이름 목록에서 무작위로 당첨자를 뽑습니다. 한 줄에 한 명씩 붙여넣고 순서를 섞을 수 있으며, 뽑힌 사람을 목록에서 빼는 것도 가능합니다." @@ -4177,6 +4181,57 @@ "download": "다운로드", "emptyQueueHint": "추가한 파일이 여기에 표시됩니다." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "언어 선택", "langFetch": "JavaScript (fetch)", diff --git a/messages/pl.json b/messages/pl.json index 86bb9b5c..adaa7b82 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -788,6 +788,10 @@ "name": "Wideo na audio", "description": "Wyodrębniaj dźwięk z filmów w przeglądarce — na wejściu MP4, MOV, MKV, AVI lub WebM, na wyjściu MP3, M4A, OGG lub WAV. Konwersja wsadowa, wybór bitrate'u, opcjonalne przycinanie. Bez przesyłania." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "Koło fortuny z imionami", "description": "Zakręć konfigurowalnym kołem, aby losowo wybrać zwycięzcę z listy imion. Wklej po jednym imieniu w wierszu, przetasuj kolejność i opcjonalnie usuwaj każde wylosowane imię." @@ -4177,6 +4181,57 @@ "download": "Pobierz", "emptyQueueHint": "Dodane pliki pojawią się tutaj." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Wybierz język", "langFetch": "JavaScript (fetch)", diff --git a/messages/pt-BR.json b/messages/pt-BR.json index c891502c..08b84e35 100644 --- a/messages/pt-BR.json +++ b/messages/pt-BR.json @@ -784,6 +784,10 @@ "name": "Vídeo para Áudio", "description": "Extraia o áudio de vídeos direto no navegador — MP4, MOV, MKV, AVI ou WebM na entrada, MP3, M4A, OGG ou WAV na saída. Converta em lote, escolha a taxa de bits e corte se quiser. Sem upload de arquivos." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "Roleta de Nomes", "description": "Gire uma roleta personalizável para sortear um vencedor de uma lista de nomes. Cole um nome por linha, embaralhe a ordem e, se quiser, remova cada vencedor após ser sorteado." @@ -4133,6 +4137,57 @@ "download": "Baixar", "emptyQueueHint": "Os arquivos que você adicionar aparecerão aqui." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Selecione o idioma", "langFetch": "JavaScript (fetch)", diff --git a/messages/ru.json b/messages/ru.json index 4c510543..bb535094 100644 --- a/messages/ru.json +++ b/messages/ru.json @@ -784,6 +784,10 @@ "name": "Видео в аудио", "description": "Извлекайте аудио из видео прямо в браузере — MP4, MOV, MKV, AVI или WebM на входе, MP3, M4A, OGG или WAV на выходе. Пакетная конвертация, выбор битрейта, обрезка по желанию. Без загрузки файлов." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "Колесо имён", "description": "Крутите настраиваемое колесо, чтобы случайно выбрать победителя из списка имён. Вставьте по одному имени на строку, перемешайте порядок и при желании убирайте каждого победителя после выбора." @@ -4133,6 +4137,57 @@ "download": "Скачать", "emptyQueueHint": "Добавленные файлы появятся здесь." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Выберите язык", "langFetch": "JavaScript (fetch)", diff --git a/messages/tr.json b/messages/tr.json index 77451b7a..41bde710 100644 --- a/messages/tr.json +++ b/messages/tr.json @@ -788,6 +788,10 @@ "name": "Videodan Sese", "description": "Videolardaki sesi tarayıcınızda ayıklayın — girdi olarak MP4, MOV, MKV, AVI veya WebM; çıktı olarak MP3, M4A, OGG veya WAV. Toplu dönüştürün, bit hızını seçin, isterseniz kırpın. Yükleme yok." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "İsim Çarkı", "description": "Özelleştirilebilir bir çarkı çevirerek isim listesinden rastgele kazanan seçin. Her satıra bir isim yapıştırın, sırayı karıştırın ve isterseniz seçilen her kazananı listeden çıkarın." @@ -4177,6 +4181,57 @@ "download": "İndir", "emptyQueueHint": "Eklediğiniz dosyalar burada görünecek." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Dil seçin", "langFetch": "JavaScript (fetch)", diff --git a/messages/vi.json b/messages/vi.json index 9e677cd9..a4dd55ec 100644 --- a/messages/vi.json +++ b/messages/vi.json @@ -788,6 +788,10 @@ "name": "Video sang âm thanh", "description": "Trích xuất âm thanh từ video trong trình duyệt — đầu vào MP4, MOV, MKV, AVI hoặc WebM, đầu ra MP3, M4A, OGG hoặc WAV. Chuyển đổi hàng loạt, chọn bitrate, cắt tuỳ chọn. Không tải lên." }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "Vòng quay tên", "description": "Quay vòng quay tuỳ chỉnh để chọn ngẫu nhiên người thắng từ một danh sách tên. Dán mỗi dòng một tên, xáo trộn thứ tự và tuỳ chọn loại bỏ người thắng sau mỗi lượt quay." @@ -4177,6 +4181,57 @@ "download": "Tải xuống", "emptyQueueHint": "Tệp được thêm sẽ hiện ở đây." }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "Chọn ngôn ngữ", "langFetch": "JavaScript (fetch)", diff --git a/messages/zh-CN.json b/messages/zh-CN.json index 9118e39c..1ccb11f8 100644 --- a/messages/zh-CN.json +++ b/messages/zh-CN.json @@ -784,6 +784,10 @@ "name": "视频转音频", "description": "直接在浏览器中从视频提取音频 — 输入 MP4、MOV、MKV、AVI 或 WebM,输出 MP3、M4A、OGG 或 WAV。支持批量转换、选择比特率,还可按需裁剪。无需上传文件。" }, + "video-converter": { + "name": "Video Converter", + "description": "Convert videos between MP4, WebM, MKV, AVI, MOV and GIF in your browser. Pick the resolution, quality and audio, trim a range, and watch live progress with cancel. No uploads." + }, "wheel-of-names": { "name": "抽奖转盘", "description": "旋转可自定义的转盘,从姓名列表中随机抽取一位获胜者。每行输入一个姓名,可打乱顺序,也可设置获胜者被抽中后自动移除。" @@ -4133,6 +4137,57 @@ "download": "下载", "emptyQueueHint": "添加的文件将显示在此处。" }, + "VideoConverter": { + "dropVideoHere": "Drop your video here", + "supportedFormats": "MP4, MOV, MKV, AVI, WebM, FLV, WMV, M4V or TS — up to 500 MB", + "change": "Change", + "videoTooLarge": "Video size should be less than 500MB", + "settings": "Conversion settings", + "outputFormat": "Output format", + "format_mp4": "MP4 (H.264 / AAC)", + "format_webm": "WebM (VP9 / Opus)", + "format_mkv": "MKV (H.264 / AAC)", + "format_avi": "AVI (MPEG-4 / MP3)", + "format_gif": "GIF (animated, no audio)", + "format_mov": "MOV (H.264 / AAC)", + "quality": "Quality", + "quality_high": "High", + "quality_medium": "Medium", + "quality_low": "Low", + "resolution": "Resolution", + "resolutionOriginal": "Original", + "audio": "Audio", + "audio_keep": "Keep audio", + "audio_bitrate": "Re-encode at a bitrate", + "audio_strip": "Remove audio", + "gifNoAudio": "GIF has no audio track.", + "bitrate": "Audio bitrate", + "trimStart": "Trim start", + "trimEnd": "Trim end", + "trimPlaceholder": "mm:ss", + "trimHint": "Optional. Leave both empty to convert the whole video.", + "invalidTrim": "Invalid trim — check the times (start must be before end).", + "convert": "Convert", + "converting": "Converting…", + "cancel": "Cancel", + "cancelling": "Cancelling…", + "cancelled": "Conversion cancelled.", + "convertingPlaceholder": "Your converted video will appear here when it's done", + "outputPlaceholder": "Converted video will appear here", + "previewUnavailable": "This format can't be previewed in the browser — download to play it.", + "inputPreviewUnavailable": "The browser can't play this format, but it can still be converted.", + "speed": "Speed", + "eta": "Time left", + "elapsed": "Elapsed", + "calculating": "Calculating…", + "originalSize": "Original size", + "outputSize": "Converted size", + "sizeChange": "Size change", + "convertSuccess": "Video converted successfully!", + "convertFailed": "Failed to convert video. Try another format or a shorter trim range.", + "engineLoadFailed": "Couldn't load the conversion engine. Check your connection and try again.", + "downloadedSuccess": "Video downloaded!" + }, "CurlConverter": { "selectLanguage": "选择语言", "langFetch": "JavaScript (fetch)", diff --git a/src/__tests__/components/VideoConverter.test.tsx b/src/__tests__/components/VideoConverter.test.tsx new file mode 100644 index 00000000..db88296d --- /dev/null +++ b/src/__tests__/components/VideoConverter.test.tsx @@ -0,0 +1,243 @@ +import { describe, it, expect, vi, beforeEach } from "vitest"; +import { render, screen, waitFor } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import VideoConverter from "@/components/VideoConverter"; +import { __resetForTests } from "@/lib/media/ffmpeg"; + +// Canonical ffmpeg mock (CompressVideo / VideoToAudio pattern), extended with +// the "log" channel the converter reads duration + progress from, and +// terminate() for the cancel path. +let progressHandler: ((e: { progress: number; time: number }) => void) | null = null; +let logHandler: ((e: { type: string; message: string }) => void) | null = null; + +const load = vi.fn().mockResolvedValue(undefined); +const writeFile = vi.fn().mockResolvedValue(undefined); +const readFile = vi.fn().mockResolvedValue(new Uint8Array([1, 2, 3, 4])); +const deleteFile = vi.fn().mockResolvedValue(undefined); +const terminate = vi.fn(); + +function emitHappyRun() { + logHandler?.({ type: "stderr", message: " Duration: 00:01:40.00, start: 0.000000, bitrate: 1 kb/s" }); + logHandler?.({ type: "stderr", message: "frame= 100 fps=25 q=28.0 size=1kB time=00:00:50.00 bitrate=1kbits/s speed=1x" }); + progressHandler?.({ progress: 0.5, time: 50_000_000 }); +} + +const exec = vi.fn().mockImplementation(async () => { + emitHappyRun(); + return 0; +}); + +vi.mock("@ffmpeg/ffmpeg", () => ({ + FFmpeg: class { + on(event: string, cb: unknown) { + if (event === "progress") progressHandler = cb as typeof progressHandler; + if (event === "log") logHandler = cb as typeof logHandler; + } + off(event: string) { + if (event === "progress") progressHandler = null; + if (event === "log") logHandler = null; + } + load = load; + writeFile = writeFile; + exec = exec; + readFile = readFile; + deleteFile = deleteFile; + terminate = terminate; + }, +})); +vi.mock("@ffmpeg/util", () => ({ + toBlobURL: vi.fn().mockResolvedValue("blob:mock-core"), + fetchFile: vi.fn().mockResolvedValue(new Uint8Array([0])), +})); + +beforeEach(() => { + __resetForTests(); + progressHandler = null; + logHandler = null; + [load, writeFile, exec, readFile, deleteFile, terminate].forEach((f) => f.mockClear()); + exec.mockImplementation(async () => { + emitHappyRun(); + return 0; + }); +}); + +async function uploadVideo(container: HTMLElement, name = "clip.mov") { + const user = userEvent.setup(); + const input = container.querySelector('input[type="file"]') as HTMLInputElement; + await user.upload(input, new File(["x".repeat(1000)], name, { type: "video/quicktime" })); + await screen.findByText(name); + return user; +} + +const convertButton = () => screen.getByTestId("tool-shell-primary"); + +describe("VideoConverter", () => { + it("renders the dropzone and a disabled Convert until a file is chosen", () => { + render(); + expect(screen.getByText(/drop your video here/i)).toBeInTheDocument(); + expect(convertButton()).toHaveTextContent(/convert/i); + expect(convertButton()).toBeDisabled(); + }); + + it("converts to MP4 by default with x264 + aac and offers a download", async () => { + const { container } = render(); + const user = await uploadVideo(container); + expect(convertButton()).toBeEnabled(); + await user.click(convertButton()); + await waitFor(() => expect(exec).toHaveBeenCalledTimes(1)); + + const args = exec.mock.calls[0][0] as string[]; + expect(args).toContain("libx264"); + expect(args).toContain("aac"); + expect(args[args.length - 1]).toBe("output.mp4"); + expect(writeFile).toHaveBeenCalledWith("input.mov", expect.anything()); + + await waitFor(() => + expect(screen.getByRole("button", { name: /download/i })).toBeEnabled() + ); + // Both scratch files are removed from the ffmpeg FS afterwards. + expect(deleteFile).toHaveBeenCalledWith("input.mov"); + expect(deleteFile).toHaveBeenCalledWith("output.mp4"); + // Converted-size stats appear. + expect(screen.getByText(/converted size/i)).toBeInTheDocument(); + }); + + it("passes the chosen format, resolution and audio mode to ffmpeg", async () => { + const { container } = render(); + const user = await uploadVideo(container); + + await user.click(screen.getByLabelText(/output format/i)); + await user.click(await screen.findByRole("option", { name: /webm/i })); + await user.click(screen.getByLabelText(/resolution/i)); + await user.click(await screen.findByRole("option", { name: "720p" })); + await user.click(screen.getByLabelText(/^audio$/i)); + await user.click(await screen.findByRole("option", { name: /remove audio/i })); + + await user.click(convertButton()); + await waitFor(() => expect(exec).toHaveBeenCalled()); + const args = exec.mock.calls[0][0] as string[]; + expect(args).toContain("libvpx-vp9"); + expect(args[args.indexOf("-vf") + 1]).toBe("scale=-2:720"); + expect(args).toContain("-an"); + expect(args[args.length - 1]).toBe("output.webm"); + }); + + it("disables the audio control for GIF and produces a silent palette pipeline", async () => { + const { container } = render(); + const user = await uploadVideo(container); + await user.click(screen.getByLabelText(/output format/i)); + await user.click(await screen.findByRole("option", { name: /gif/i })); + expect(screen.getByLabelText(/^audio$/i)).toBeDisabled(); + expect(screen.getByText(/gif has no audio track/i)).toBeInTheDocument(); + + await user.click(convertButton()); + await waitFor(() => expect(exec).toHaveBeenCalled()); + const args = exec.mock.calls[0][0] as string[]; + expect(args[args.indexOf("-vf") + 1]).toContain("palettegen"); + expect(args).toContain("-an"); + }); + + it("applies trim as an input seek and output duration", async () => { + const { container } = render(); + const user = await uploadVideo(container); + await user.type(screen.getByLabelText(/trim start/i), "0:10"); + await user.type(screen.getByLabelText(/trim end/i), "1:00"); + await user.click(convertButton()); + await waitFor(() => expect(exec).toHaveBeenCalled()); + const args = exec.mock.calls[0][0] as string[]; + expect(args.indexOf("-ss")).toBeLessThan(args.indexOf("-i")); + expect(args[args.indexOf("-ss") + 1]).toBe("10"); + expect(args[args.indexOf("-t") + 1]).toBe("50"); + }); + + it("rejects an inverted trim range without booting ffmpeg", async () => { + const { container } = render(); + const user = await uploadVideo(container); + await user.type(screen.getByLabelText(/trim start/i), "2:00"); + await user.type(screen.getByLabelText(/trim end/i), "1:00"); + await user.click(convertButton()); + expect(await screen.findByText(/invalid trim/i)).toBeInTheDocument(); + expect(load).not.toHaveBeenCalled(); + expect(exec).not.toHaveBeenCalled(); + }); + + it("shows live progress (percent, speed, ETA) while converting", async () => { + let finish: () => void = () => {}; + exec.mockImplementationOnce( + () => + new Promise((resolve) => { + emitHappyRun(); + finish = () => resolve(0); + }) + ); + const { container } = render(); + const user = await uploadVideo(container); + await user.click(convertButton()); + + const panel = await screen.findByTestId("vc-progress"); + // 50s of a 100s source encoded → 50%. + await waitFor(() => expect(panel).toHaveTextContent("50%")); + expect(panel).toHaveTextContent(/speed/i); + expect(panel).toHaveTextContent(/time left/i); + expect(convertButton()).toHaveTextContent(/cancel/i); + + finish(); + await waitFor(() => expect(screen.queryByTestId("vc-progress")).not.toBeInTheDocument()); + expect(convertButton()).toHaveTextContent(/convert/i); + }); + + it("cancels an in-flight conversion by terminating the worker", async () => { + let reject: (e: Error) => void = () => {}; + exec.mockImplementationOnce( + () => + new Promise((_, rej) => { + reject = rej; + }) + ); + // Simulate ffmpeg.wasm: terminate() rejects the pending exec. + terminate.mockImplementationOnce(() => reject(new Error("called FFmpeg.terminate()"))); + + const { container } = render(); + const user = await uploadVideo(container); + await user.click(convertButton()); + await waitFor(() => expect(convertButton()).toHaveTextContent(/cancel/i)); + + await user.click(convertButton()); + await waitFor(() => expect(terminate).toHaveBeenCalledTimes(1)); + await waitFor(() => expect(convertButton()).toHaveTextContent(/convert/i)); + expect(convertButton()).toBeEnabled(); + // No result from a cancelled run. + expect(screen.getByRole("button", { name: /download/i })).toBeDisabled(); + // Worker is gone — no FS cleanup calls were attempted. + expect(deleteFile).not.toHaveBeenCalled(); + + // A fresh engine boots on the next run (cache was dropped). + await user.click(convertButton()); + await waitFor(() => expect(exec).toHaveBeenCalledTimes(2)); + expect(load).toHaveBeenCalledTimes(2); + }); + + it("surfaces a failure when ffmpeg exits non-zero", async () => { + exec.mockImplementationOnce(async () => 1); + const { container } = render(); + const user = await uploadVideo(container); + await user.click(convertButton()); + await waitFor(() => expect(exec).toHaveBeenCalled()); + await waitFor(() => expect(convertButton()).toHaveTextContent(/convert/i)); + expect(screen.getByRole("button", { name: /download/i })).toBeDisabled(); + }); + + it("swapping the file clears a previous result", async () => { + const { container } = render(); + const user = await uploadVideo(container); + await user.click(convertButton()); + await waitFor(() => + expect(screen.getByRole("button", { name: /download/i })).toBeEnabled() + ); + await user.click(screen.getByRole("button", { name: /change/i })); + const input = document.querySelector('input[type="file"]') as HTMLInputElement; + await user.upload(input, new File(["y".repeat(10)], "other.mkv", { type: "" })); + await screen.findByText("other.mkv"); + expect(screen.getByRole("button", { name: /download/i })).toBeDisabled(); + }); +}); diff --git a/src/__tests__/lib/ffmpeg.test.ts b/src/__tests__/lib/ffmpeg.test.ts index 17faee8a..ce9ed863 100644 --- a/src/__tests__/lib/ffmpeg.test.ts +++ b/src/__tests__/lib/ffmpeg.test.ts @@ -1,6 +1,7 @@ import { describe, it, expect, vi } from "vitest"; const load = vi.fn().mockResolvedValue(undefined); +const terminate = vi.fn(); // FFmpeg is used with `new`, so the mock must be constructable — a `class` // (matching the repo's CompressVideo test) rather than an arrow-returning // vi.fn(), which is not a valid constructor under vitest v4. @@ -9,6 +10,7 @@ vi.mock("@ffmpeg/ffmpeg", () => ({ load = load; on = vi.fn(); off = vi.fn(); + terminate = terminate; loaded = false; }, })); @@ -16,7 +18,29 @@ vi.mock("@ffmpeg/util", () => ({ toBlobURL: vi.fn().mockResolvedValue("blob:mock-core"), })); -import { getFFmpeg, __resetForTests } from "@/lib/media/ffmpeg"; +import { getFFmpeg, terminateFFmpeg, __resetForTests } from "@/lib/media/ffmpeg"; + +describe("terminateFFmpeg", () => { + it("terminates the cached worker and drops the cache so the next call reloads", async () => { + __resetForTests(); + load.mockClear(); + terminate.mockClear(); + const first = await getFFmpeg(); + terminateFFmpeg(); + await Promise.resolve(); // let the .then(terminate) settle + expect(terminate).toHaveBeenCalledTimes(1); + const second = await getFFmpeg(); + expect(second).not.toBe(first); + expect(load).toHaveBeenCalledTimes(2); + }); + + it("is a no-op when nothing has been loaded", () => { + __resetForTests(); + terminate.mockClear(); + expect(() => terminateFFmpeg()).not.toThrow(); + expect(terminate).not.toHaveBeenCalled(); + }); +}); describe("getFFmpeg", () => { it("loads once and returns the same instance on repeat calls", async () => { diff --git a/src/__tests__/lib/video-convert.test.ts b/src/__tests__/lib/video-convert.test.ts new file mode 100644 index 00000000..49d3241e --- /dev/null +++ b/src/__tests__/lib/video-convert.test.ts @@ -0,0 +1,232 @@ +import { describe, it, expect } from "vitest"; +import { + buildConvertArgs, + computeProgressStats, + fileExtension, + formatEta, + formatSpeed, + isValidTrimRange, + outputFilename, + parseDurationLine, + parseProgressTime, + targetDuration, + type ConvertOptions, +} from "@/lib/media/video-convert"; + +const base: ConvertOptions = { + format: "mp4", + quality: "medium", + resolution: "original", + audio: "keep", + audioBitrate: "192k", + trimStart: null, + trimEnd: null, +}; + +function args(overrides: Partial = {}) { + return buildConvertArgs("input.mov", "output.x", { ...base, ...overrides }); +} + +function valueAfter(list: string[], flag: string, nth = 0): string | undefined { + let seen = 0; + for (let i = 0; i < list.length; i++) { + if (list[i] === flag) { + if (seen === nth) return list[i + 1]; + seen++; + } + } + return undefined; +} + +describe("buildConvertArgs", () => { + it("encodes MP4 as H.264 + AAC with faststart", () => { + const a = args({ format: "mp4" }); + expect(a[0]).toBe("-y"); + expect(valueAfter(a, "-c:v")).toBe("libx264"); + expect(valueAfter(a, "-crf")).toBe("23"); + expect(valueAfter(a, "-c:a")).toBe("aac"); + expect(valueAfter(a, "-b:a")).toBe("128k"); // keep → default bitrate + expect(a).toContain("-movflags"); + expect(a[a.length - 1]).toBe("output.x"); + }); + + it("encodes WebM as VP9 + Opus in constant-quality mode", () => { + const a = args({ format: "webm", quality: "high" }); + expect(valueAfter(a, "-c:v")).toBe("libvpx-vp9"); + expect(valueAfter(a, "-crf")).toBe("24"); + expect(valueAfter(a, "-b:v")).toBe("0"); + expect(valueAfter(a, "-c:a")).toBe("libopus"); + expect(a).not.toContain("-movflags"); + }); + + it("encodes AVI as MPEG-4 (xvid tag) + MP3 with -q:v quality", () => { + const a = args({ format: "avi", quality: "low" }); + expect(valueAfter(a, "-c:v")).toBe("mpeg4"); + expect(valueAfter(a, "-vtag")).toBe("xvid"); + expect(valueAfter(a, "-q:v")).toBe("9"); + expect(valueAfter(a, "-c:a")).toBe("libmp3lame"); + }); + + it("uses x264 for MKV and MOV, faststart only for MOV", () => { + expect(valueAfter(args({ format: "mkv" }), "-c:v")).toBe("libx264"); + expect(args({ format: "mkv" })).not.toContain("-movflags"); + expect(valueAfter(args({ format: "mov" }), "-c:v")).toBe("libx264"); + expect(args({ format: "mov" })).toContain("-movflags"); + }); + + it("builds a palette pipeline for GIF, always silent, looping", () => { + const a = args({ format: "gif", quality: "medium", resolution: "480p" }); + const vf = valueAfter(a, "-vf") ?? ""; + expect(vf).toMatch(/^fps=12,scale=-2:480:flags=lanczos,split/); + expect(vf).toContain("palettegen=max_colors=128"); + expect(vf).toContain("paletteuse"); + expect(a).toContain("-an"); + expect(a).not.toContain("-c:a"); + expect(valueAfter(a, "-loop")).toBe("0"); + // Audio mode is irrelevant for GIF — still silent. + expect(args({ format: "gif", audio: "bitrate" })).toContain("-an"); + }); + + it("maps the quality preset onto x264 CRF", () => { + expect(valueAfter(args({ quality: "high" }), "-crf")).toBe("18"); + expect(valueAfter(args({ quality: "medium" }), "-crf")).toBe("23"); + expect(valueAfter(args({ quality: "low" }), "-crf")).toBe("28"); + }); + + it("adds an even-width scale filter for a target resolution", () => { + expect(args({ resolution: "original" })).not.toContain("-vf"); + expect(valueAfter(args({ resolution: "1080p" }), "-vf")).toBe("scale=-2:1080"); + expect(valueAfter(args({ resolution: "720p" }), "-vf")).toBe("scale=-2:720"); + expect(valueAfter(args({ resolution: "480p" }), "-vf")).toBe("scale=-2:480"); + }); + + it("honours the audio modes", () => { + const strip = args({ audio: "strip" }); + expect(strip).toContain("-an"); + expect(strip).not.toContain("-c:a"); + + const custom = args({ audio: "bitrate", audioBitrate: "320k" }); + expect(valueAfter(custom, "-b:a")).toBe("320k"); + }); + + it("applies trim as an input seek plus an output duration", () => { + const both = args({ trimStart: 10, trimEnd: 70 }); + const ss = both.indexOf("-ss"); + const i = both.indexOf("-i"); + expect(ss).toBeGreaterThan(-1); + expect(ss).toBeLessThan(i); // input option → fast seek + expect(both[ss + 1]).toBe("10"); + expect(both.indexOf("-t")).toBeGreaterThan(i); // output option + expect(valueAfter(both, "-t")).toBe("60"); + + const onlyEnd = args({ trimEnd: 45 }); + expect(onlyEnd).not.toContain("-ss"); + expect(valueAfter(onlyEnd, "-t")).toBe("45"); + + const onlyStart = args({ trimStart: 5 }); + expect(valueAfter(onlyStart, "-ss")).toBe("5"); + expect(onlyStart).not.toContain("-t"); + }); +}); + +describe("isValidTrimRange", () => { + it("accepts empty, single-sided and ordered ranges", () => { + expect(isValidTrimRange(null, null)).toBe(true); + expect(isValidTrimRange(5, null)).toBe(true); + expect(isValidTrimRange(null, 5)).toBe(true); + expect(isValidTrimRange(1, 5)).toBe(true); + }); + it("rejects reversed, equal, negative or zero-length ranges", () => { + expect(isValidTrimRange(5, 5)).toBe(false); + expect(isValidTrimRange(9, 5)).toBe(false); + expect(isValidTrimRange(-1, 5)).toBe(false); + expect(isValidTrimRange(null, 0)).toBe(false); + }); +}); + +describe("names", () => { + it("swaps the extension for the target format", () => { + expect(outputFilename("holiday.MOV", "mp4")).toBe("holiday.mp4"); + expect(outputFilename("clip", "gif")).toBe("clip.gif"); + expect(outputFilename("a.b.c.mkv", "webm")).toBe("a.b.c.webm"); + }); + it("extracts a lower-cased extension", () => { + expect(fileExtension("Movie.MKV")).toBe("mkv"); + expect(fileExtension("noext")).toBe("bin"); + expect(fileExtension("trailing.")).toBe("bin"); + }); +}); + +describe("ffmpeg log parsing", () => { + it("reads the source duration from the input banner", () => { + expect(parseDurationLine(" Duration: 00:01:23.45, start: 0.000000, bitrate: 1200 kb/s")).toBeCloseTo(83.45); + expect(parseDurationLine(" Duration: 01:00:00.00, bitrate: N/A")).toBe(3600); + expect(parseDurationLine("Stream #0:0: Video: h264")).toBeNull(); + }); + it("reads the encoded position from a stats line", () => { + expect(parseProgressTime("frame= 120 fps= 24 q=28.0 size= 512kB time=00:00:05.00 bitrate= 838.9kbits/s speed=0.5x")).toBe(5); + expect(parseProgressTime("frame=1 time=00:02:03.50 speed=1x")).toBeCloseTo(123.5); + expect(parseProgressTime("time=N/A")).toBeNull(); + // A duration banner must not be misread as progress. + expect(parseProgressTime(" Duration: 00:01:23.45, start: 0")).toBeNull(); + }); +}); + +describe("targetDuration", () => { + it("prefers the trim window, falls back to source minus start", () => { + expect(targetDuration(null, 10, 70)).toBe(60); + expect(targetDuration(100, null, 30)).toBe(30); + expect(targetDuration(100, 10, null)).toBe(90); + expect(targetDuration(100, null, null)).toBe(100); + expect(targetDuration(null, 10, null)).toBeNull(); + }); +}); + +describe("computeProgressStats", () => { + it("derives percent, speed and ETA when the target is known", () => { + const s = computeProgressStats({ + processedSec: 30, + elapsedSec: 15, + targetSec: 120, + fallbackRatio: 0, + }); + expect(s.percent).toBe(25); + expect(s.speed).toBe(2); + expect(s.etaSec).toBe(45); + }); + it("uses ffmpeg's ratio when the target is unknown and never reports 100", () => { + const s = computeProgressStats({ + processedSec: 30, + elapsedSec: 15, + targetSec: null, + fallbackRatio: 1, + }); + expect(s.percent).toBe(99); + expect(s.speed).toBe(2); + expect(s.etaSec).toBeNull(); + }); + it("withholds speed until there is enough signal", () => { + const s = computeProgressStats({ + processedSec: 0, + elapsedSec: 0.2, + targetSec: 10, + fallbackRatio: 0, + }); + expect(s.speed).toBeNull(); + expect(s.etaSec).toBeNull(); + expect(s.percent).toBe(0); + }); +}); + +describe("formatting", () => { + it("formats speed with one decimal", () => { + expect(formatSpeed(0.48)).toBe("0.5×"); + expect(formatSpeed(12.3)).toBe("12×"); + }); + it("formats an ETA coarsely", () => { + expect(formatEta(42)).toBe("42s"); + expect(formatEta(125)).toBe("2m 05s"); + expect(formatEta(3780)).toBe("1h 03m"); + expect(formatEta(-3)).toBe("0s"); + }); +}); diff --git a/src/app/tools/video-converter/opengraph-image.tsx b/src/app/tools/video-converter/opengraph-image.tsx new file mode 100644 index 00000000..69d02bbc --- /dev/null +++ b/src/app/tools/video-converter/opengraph-image.tsx @@ -0,0 +1,9 @@ +import { generateToolOgImage, ogSize, ogContentType } from "@/lib/og-image"; + +export const alt = "video-converter | BrowseryTools"; +export const size = ogSize; +export const contentType = ogContentType; + +export default function Image() { + return generateToolOgImage("video-converter"); +} diff --git a/src/app/tools/video-converter/page.tsx b/src/app/tools/video-converter/page.tsx new file mode 100644 index 00000000..91dfc503 --- /dev/null +++ b/src/app/tools/video-converter/page.tsx @@ -0,0 +1,8 @@ +import VideoConverter from "@/components/VideoConverter"; +import { generateToolMetadata } from "@/lib/metadata"; + +export const metadata = generateToolMetadata("/tools/video-converter"); + +export default function Page() { + return ; +} diff --git a/src/app/tools/video-converter/twitter-image.tsx b/src/app/tools/video-converter/twitter-image.tsx new file mode 100644 index 00000000..69d02bbc --- /dev/null +++ b/src/app/tools/video-converter/twitter-image.tsx @@ -0,0 +1,9 @@ +import { generateToolOgImage, ogSize, ogContentType } from "@/lib/og-image"; + +export const alt = "video-converter | BrowseryTools"; +export const size = ogSize; +export const contentType = ogContentType; + +export default function Image() { + return generateToolOgImage("video-converter"); +} diff --git a/src/components/VideoConverter.tsx b/src/components/VideoConverter.tsx new file mode 100644 index 00000000..2c813d96 --- /dev/null +++ b/src/components/VideoConverter.tsx @@ -0,0 +1,735 @@ +"use client"; + +import { useCallback, useEffect, useRef, useState } from "react"; +import { useTranslations } from "next-intl"; +import { ToolShell } from "@/components/template/tool-shell"; +import { FileDropzone } from "@/components/shared/FileDropzone"; +import { SettingsCard, OptionRow } from "@/components/shared/SettingsCard"; +import { StatStrip } from "@/components/shared/StatStrip"; +import { TwoPane } from "@/components/shared/TwoPane"; +import { Button } from "@/components/ui/button"; +import { Card } from "@/components/ui/card"; +import { Input } from "@/components/ui/input"; +import { Progress } from "@/components/ui/progress"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { + Download, + FileVideo, + Loader2, + RefreshCw, + Upload, + Video, +} from "lucide-react"; +import { toast } from "sonner"; +import { getFFmpeg, terminateFFmpeg } from "@/lib/media/ffmpeg"; +import { parseTimeInput } from "@/lib/media/time"; +import { + AUDIO_BITRATES, + AUDIO_MODES, + DEFAULT_AUDIO_BITRATE, + FORMAT_SPECS, + INPUT_EXTENSIONS, + OUTPUT_FORMATS, + QUALITIES, + RESOLUTIONS, + buildConvertArgs, + computeProgressStats, + fileExtension, + formatEta, + formatSpeed, + isValidTrimRange, + outputFilename, + parseDurationLine, + parseProgressTime, + targetDuration, + type AudioMode, + type OutputFormat, + type Quality, + type Resolution, +} from "@/lib/media/video-convert"; +import { downloadUrl } from "@/lib/download"; +import { formatBytes } from "@/lib/format"; + +const MAX_FILE_SIZE = 500 * 1024 * 1024; + +interface VideoInfo { + file: File; + url: string; + name: string; + size: number; +} + +interface OutputInfo { + url: string; + size: number; + format: OutputFormat; + filename: string; +} + +/** Live numbers for the in-flight run; everything shown is derived from these. */ +interface RunState { + processedSec: number; + targetSec: number | null; + elapsedSec: number; + fallbackRatio: number; +} + +const INITIAL_RUN: RunState = { + processedSec: 0, + targetSec: null, + elapsedSec: 0, + fallbackRatio: 0, +}; + +/** Thrown when ffmpeg exits non-zero without the worker itself dying. */ +class FfmpegExitError extends Error { + constructor(code: number) { + super(`ffmpeg exited with code ${code}`); + } +} + +export default function VideoConverter() { + const t = useTranslations("Tools.VideoConverter"); + const tCommon = useTranslations("Common"); + const tc = useTranslations("ToolsConfig"); + + const [video, setVideo] = useState(null); + const [inputPreviewFailed, setInputPreviewFailed] = useState(false); + const [format, setFormat] = useState("mp4"); + const [quality, setQuality] = useState("medium"); + const [resolution, setResolution] = useState("original"); + const [audioMode, setAudioMode] = useState("keep"); + const [audioBitrate, setAudioBitrate] = useState( + DEFAULT_AUDIO_BITRATE, + ); + const [trimStart, setTrimStart] = useState(""); + const [trimEnd, setTrimEnd] = useState(""); + const [trimError, setTrimError] = useState(false); + + const [converting, setConverting] = useState(false); + const [cancelling, setCancelling] = useState(false); + const [run, setRun] = useState(INITIAL_RUN); + const [output, setOutput] = useState(null); + + const inputUrlRef = useRef(null); + const outputUrlRef = useRef(null); + const fileInputRef = useRef(null); + // Bumped on every file swap and every run start. A progress event or a + // result from a superseded run checks this before touching state + // (CompressVideo's activeVideoTokenRef pattern). + const runTokenRef = useRef(0); + const cancelRef = useRef(false); + const startMsRef = useRef(0); + + useEffect(() => { + return () => { + if (inputUrlRef.current) URL.revokeObjectURL(inputUrlRef.current); + if (outputUrlRef.current) URL.revokeObjectURL(outputUrlRef.current); + }; + }, []); + + // Elapsed-time tick while a run is live; speed/ETA are derived from it at + // render time so the readout keeps moving between ffmpeg's stats lines. + useEffect(() => { + if (!converting) return; + const id = window.setInterval(() => { + setRun((prev) => ({ + ...prev, + elapsedSec: (performance.now() - startMsRef.current) / 1000, + })); + }, 500); + return () => window.clearInterval(id); + }, [converting]); + + const clearOutput = useCallback(() => { + if (outputUrlRef.current) { + URL.revokeObjectURL(outputUrlRef.current); + outputUrlRef.current = null; + } + setOutput(null); + }, []); + + const onDrop = useCallback( + (acceptedFiles: File[]) => { + const file = acceptedFiles[0]; + if (!file) return; + if (file.size > MAX_FILE_SIZE) { + toast.error(t("videoTooLarge")); + return; + } + if (inputUrlRef.current) URL.revokeObjectURL(inputUrlRef.current); + clearOutput(); + const url = URL.createObjectURL(file); + inputUrlRef.current = url; + runTokenRef.current += 1; + setVideo({ file, url, name: file.name, size: file.size }); + setInputPreviewFailed(false); + setRun(INITIAL_RUN); + setConverting(false); + setCancelling(false); + setTrimError(false); + }, + [clearOutput, t], + ); + + const handleCancel = useCallback(() => { + if (!converting || cancelling) return; + cancelRef.current = true; + setCancelling(true); + // Kills the worker: the pending exec rejects and the finally block below + // settles the UI. A fresh engine boots on the next convert. + terminateFFmpeg(); + }, [converting, cancelling]); + + const handleConvert = useCallback(async () => { + if (!video || converting) return; + + const start = trimStart.trim() !== "" ? parseTimeInput(trimStart) : null; + const end = trimEnd.trim() !== "" ? parseTimeInput(trimEnd) : null; + const startInvalid = trimStart.trim() !== "" && start === null; + const endInvalid = trimEnd.trim() !== "" && end === null; + if (startInvalid || endInvalid || !isValidTrimRange(start, end)) { + setTrimError(true); + toast.error(t("invalidTrim")); + return; + } + setTrimError(false); + + runTokenRef.current += 1; + const token = runTokenRef.current; + const isCurrentRun = () => token === runTokenRef.current; + cancelRef.current = false; + setCancelling(false); + setConverting(true); + clearOutput(); + startMsRef.current = performance.now(); + setRun({ + ...INITIAL_RUN, + targetSec: targetDuration(null, start, end), + }); + + const spec = FORMAT_SPECS[format]; + const inputName = `input.${fileExtension(video.name)}`; + const outputName = `output.${spec.ext}`; + + let ffmpeg: Awaited> | null = null; + let sourceDuration: number | null = null; + + const onLog = ({ message }: { message: string }) => { + if (!isCurrentRun()) return; + if (sourceDuration === null) { + const d = parseDurationLine(message); + if (d !== null) { + sourceDuration = d; + setRun((prev) => ({ + ...prev, + targetSec: targetDuration(d, start, end), + })); + return; + } + } + const processed = parseProgressTime(message); + if (processed !== null) { + setRun((prev) => ({ + ...prev, + processedSec: Math.max(prev.processedSec, processed), + elapsedSec: (performance.now() - startMsRef.current) / 1000, + })); + } + }; + const onProgress = ({ progress }: { progress: number }) => { + if (!isCurrentRun()) return; + const ratio = Number.isFinite(progress) + ? Math.max(0, Math.min(1, progress)) + : 0; + setRun((prev) => ({ ...prev, fallbackRatio: ratio })); + }; + + try { + const { fetchFile } = await import("@ffmpeg/util"); + try { + ffmpeg = await getFFmpeg(); + } catch (err) { + if (!cancelRef.current) { + console.error(err); + if (isCurrentRun()) toast.error(t("engineLoadFailed")); + } + return; + } + // Cancelled while the engine was still booting — terminateFFmpeg() + // already scheduled this instance's teardown; don't drive it. + if (cancelRef.current || !isCurrentRun()) return; + + ffmpeg.on("log", onLog); + ffmpeg.on("progress", onProgress); + + await ffmpeg.writeFile(inputName, await fetchFile(video.file)); + + const args = buildConvertArgs(inputName, outputName, { + format, + quality, + resolution, + audio: audioMode, + audioBitrate, + trimStart: start, + trimEnd: end, + }); + const code = await ffmpeg.exec(args); + if (typeof code === "number" && code !== 0) { + throw new FfmpegExitError(code); + } + + const data = (await ffmpeg.readFile(outputName)) as Uint8Array; + if (!data || data.length === 0) throw new FfmpegExitError(-1); + + if (!isCurrentRun()) return; + + const bytes = new Uint8Array(data); + const blob = new Blob([bytes.buffer as ArrayBuffer], { type: spec.mime }); + const url = URL.createObjectURL(blob); + outputUrlRef.current = url; + setOutput({ + url, + size: blob.size, + format, + filename: outputFilename(video.name, format), + }); + toast.success(t("convertSuccess")); + } catch (err) { + if (cancelRef.current) { + if (isCurrentRun()) toast.info(t("cancelled")); + } else { + console.error(err); + if (isCurrentRun()) toast.error(t("convertFailed")); + } + } finally { + if (ffmpeg) { + ffmpeg.off("log", onLog); + ffmpeg.off("progress", onProgress); + // After a cancel the worker is gone — nothing to clean up (and every + // call would just reject). + if (!cancelRef.current) { + for (const name of [inputName, outputName]) { + try { + await ffmpeg.deleteFile(name); + } catch { + // best-effort cleanup + } + } + } + } + if (isCurrentRun()) { + setConverting(false); + setCancelling(false); + } + } + }, [ + audioBitrate, + audioMode, + clearOutput, + converting, + format, + quality, + resolution, + t, + trimEnd, + trimStart, + video, + ]); + + const handleDownload = () => { + if (!output) return; + downloadUrl(output.url, output.filename); + toast.success(t("downloadedSuccess")); + }; + + const spec = FORMAT_SPECS[format]; + const stats = computeProgressStats(run); + const percent = converting ? stats.percent : output ? 100 : 0; + const sizeDelta = + video && output ? Math.round((1 - output.size / video.size) * 100) : null; + + const formatLabel = (f: OutputFormat) => + t(`format_${f}` as "format_mp4"); + + const outputPreview = () => { + if (!output) { + return ( +
+
+ ); + } + const preview = FORMAT_SPECS[output.format].preview; + if (preview === "video") { + return ( +