Bonjour,
Suite au post de tyrtamos, je me suis lancé dans un petit programme de conversion.
Malheureusement, j'ai l'erreur :
[NULL @ 0x55a40fee4b00] Unable to find a suitable output format for '...'
...: Invalid argument
Les ... est mon nom de fichier.



Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
 
path = r"..."
print(path)
 
end =".mkv"
liste_fich_convert = []
liste_chemin_fich_convert = []
 
for root, directories, files in os.walk(path):  
    for file in files:
        if file.endswith(end):
            liste_fich_convert.append(file)
            chemin_fich_convert = os.path.join(root,file)
            liste_chemin_fich_convert.append(chemin_fich_convert)
 
print(liste_fich_convert)
print(liste_chemin_fich_convert)
 
options_conv = [
# "-hide_banner", # cache la bannière
# "-nostdin", # empêche les questions pendant le traitement
# "-y", # permet de remplacer un fichier existant sans demander
# "-c:v", "libx264", # utilise le pilote vidéo mp4
# "-c:a", "aac", # utilise le pilote audio AAC
]
 
new_ext = "mp4"
def video_convert(source,opt):
    source_ss_ext = ".".join(source.split(".")[:-1])
    ext = source.split(".")[-1]
    # print(source_ss_ext)
    # print(ext)
    destination=source_ss_ext.replace(".","-")+new_ext
    print(source)
    print(destination)
    opt = " ".join(opt)
    print(opt)
    # print (r"ffmpeg -i {entree} {options} {sortie}".\
    #           format(entree=source,sortie=destination,options=opt))
    os.system(r"ffmpeg -i {entree} {options} {sortie}".\
              format(entree=source,sortie=destination,options=opt))
 
for el in liste_chemin_fich_convert:
    # print(el)
    video_convert(el,options_conv)
Avez-vous des idées ?
Bon week-end.