Configuration de DOSBox-X

Dans la console :

nano ~/.config/dosbox-x/dosbox-x-2025.02.01.conf

à la ligne 217,

language                  = fr_FR.lng

à la ligne 1200,

keyboardlayout                  = auto => fr

à la ligne 501,

core               = auto => dynamic

à la ligne 506,

cycles             = auto => max

rajouter dans la section [autoexec], à la ligne 1349 et 1350 :

mount c "/media/eric/Fichiers Eric/DOSBox-X"
c:

Découper et redimensionner une vidéo VirtualBox

Ma vidéo, enregistrée avec VirtualBox, est au format 1280×800 mais l’image est entourée de noir que je veux supprimer. La partie centrale qui m’intéresse est au format 640×400. Je fais donc un crop centré.

Pour automatiser (en Python) :
Usage : python3 convert.py input.webm 0 00:01:30

convert.py

import subprocess
import sys
import os

if len(sys.argv) < 4:
    print("Usage: python3 convert.py <input.webm> <start> <end>")
    print("Ex: python3 convert.py input.webm 0 00:01:30")
    sys.exit(1)

input_file = sys.argv[1]
start      = sys.argv[2]
end        = sys.argv[3]

output_name = "output"

# Filtre de crop/scale commun (la découpe se fait via -ss/-to en input)
# Remplacer "neighbor" par "lanczos" si la vidéo est réelle (non pixel art)
vf_base = "crop=640:400:320:200"
vf_hd   = "crop=640:400:320:200,scale=1280:800:flags=neighbor"

print("=== Export MP4 640x400 (H.264) ===")
subprocess.run([
    "ffmpeg",
    "-ss", start, "-to", end,
    "-i", input_file,
    "-vf", vf_base,
    "-c:v", "libx264",
    "-crf", "16",
    "-preset", "slow",
    "-pix_fmt", "yuv420p",
    "-c:a", "aac",
    "-b:a", "192k",
    "-movflags", "+faststart",
    f"{output_name}-640x400.mp4"
], check=True)

print("=== Export MP4 HD 1280x800 (H.264) ===")
subprocess.run([
    "ffmpeg",
    "-ss", start, "-to", end,
    "-i", input_file,
    "-vf", vf_hd,
    "-c:v", "libx264",
    "-crf", "10",
    "-preset", "veryslow",
    "-pix_fmt", "yuv420p",
    "-c:a", "aac",
    "-b:a", "192k",
    "-movflags", "+faststart",
    f"{output_name}-1280x800.mp4"
], check=True)

print("=== Export WEBM 640x400 (VP9) ===")
subprocess.run([
    "ffmpeg",
    "-ss", start, "-to", end,
    "-i", input_file,
    "-vf", vf_base,
    "-c:v", "libvpx-vp9",
    "-crf", "15",
    "-b:v", "0",
    "-c:a", "libopus",
    "-b:a", "192k",
    f"{output_name}-640x400.webm"
], check=True)

print("=== Export WEBM HD 1280x800 (VP9) ===")
subprocess.run([
    "ffmpeg",
    "-ss", start, "-to", end,
    "-i", input_file,
    "-vf", vf_hd,
    "-c:v", "libvpx-vp9",
    "-crf", "10",
    "-b:v", "0",
    "-deadline", "best",
    "-cpu-used", "0",
    "-c:a", "libopus",
    "-b:a", "192k",
    f"{output_name}-1280x800.webm"
], check=True)

print("=== Terminé ===")

Pour YouTube, il faut passer à 5120x3200 pour que la vidéo ne soit pas dégradée fortement.

convert5120.py

import subprocess
import sys
import os

if len(sys.argv) < 4:
    print("Usage: python3 convert5120.py <input.webm> <start> <end>")
    print("Ex: python3 convert5120.py input.webm 0 00:01:30")
    sys.exit(1)

input_file = sys.argv[1]
start      = sys.argv[2]
end        = sys.argv[3]

output_name = "output"

# Filtre de crop/scale commun (la découpe se fait via -ss/-to en input)
# Remplacer "neighbor" par "lanczos" si la vidéo est réelle (non pixel art)
vf_hd   = "crop=640:400:320:200,scale=5120:3200:flags=neighbor"

print("=== Export MP4 HD 5120x3200 (H.264) ===")
subprocess.run([
    "ffmpeg",
    "-ss", start, "-to", end,
    "-i", input_file,
    "-vf", vf_hd,
    "-c:v", "libx264",
    "-crf", "10",
    "-preset", "veryslow",
    "-pix_fmt", "yuv420p",
    "-c:a", "aac",
    "-b:a", "192k",
    "-movflags", "+faststart",
    f"{output_name}-5120x3200.mp4"
], check=True)

print("=== Terminé ===")