|
|
|
|
|
|
|
|
1
|
+::============================================================
|
|
|
|
2
|
+::=============== Programme d'encodage du JTX ================
|
|
|
|
3
|
+::============================================================
|
|
|
|
4
|
+::====== Par Denis Merigoux, inspir‚ de Nicolas Breton =======
|
|
|
|
5
|
+::============================================================
|
|
|
|
6
|
+
|
|
|
|
7
|
+::ffmpeg v2.7.2 doit ˆtre plac‚ dans le mˆme dossier que le .bat pour que celui-ci fonctionne.
|
|
|
|
8
|
+::Alternativement, on packagera le .bat et ffmpeg.exe … l'int‚rieur d'un unique .exe
|
|
|
|
9
|
+::… l'aide de http://www.f2ko.de/en/b2e.php pour plus de portabilit‚ et de protection du code.
|
|
|
|
10
|
+
|
|
|
|
11
|
+
|
|
|
|
12
|
+
|
|
|
|
13
|
+
|
|
|
|
14
|
+::On se r‚fŠrera au site http://ss64.com/ pour la documentation des commandes batch
|
|
1
|
@echo off
|
15
|
@echo off
|
|
|
|
16
|
+::Titre de la fenˆtre de ligne de commande.
|
|
2
|
title= ---- Encodeur du JTX ----
|
17
|
title= ---- Encodeur du JTX ----
|
|
|
|
18
|
+::Couleur du texte et du fond
|
|
3
|
color 0D
|
19
|
color 0D
|
|
|
|
20
|
+::Efface l'‚cran
|
|
4
|
cls
|
21
|
cls
|
|
5
|
echo ******************************************************
|
22
|
echo ******************************************************
|
|
6
|
echo ****************** Encodeur du JTX *******************
|
23
|
echo ****************** Encodeur du JTX *******************
|
|
|
|
|
|
|
17
|
echo 3 : Web 854x480 1.5 Mbits/s 25 i/s
|
34
|
echo 3 : Web 854x480 1.5 Mbits/s 25 i/s
|
|
18
|
echo 4 : Archives 720x576 1.5 Mbits/s 25 i/s
|
35
|
echo 4 : Archives 720x576 1.5 Mbits/s 25 i/s
|
|
19
|
echo.
|
36
|
echo.
|
|
|
|
37
|
+::Affiche un prompt d'une seule touche
|
|
20
|
choice /C 1234 /N /M " S‚lectionez le r‚glage en appuyant sur [1], [2], [3] ou [4] :"
|
38
|
choice /C 1234 /N /M " S‚lectionez le r‚glage en appuyant sur [1], [2], [3] ou [4] :"
|
|
|
|
39
|
+::R‚cup‚ration mystique du r‚sultat de choice
|
|
|
|
40
|
+::L'ordre des if est important (?!)...
|
|
21
|
if errorlevel 4 (
|
41
|
if errorlevel 4 (
|
|
22
|
echo.
|
42
|
echo.
|
|
23
|
color 0E
|
43
|
color 0E
|
|
|
|
|
|
|
27
|
echo ***** Appuie sur un touche pour lancer l'encodage ******
|
47
|
echo ***** Appuie sur un touche pour lancer l'encodage ******
|
|
28
|
echo ********************************************************
|
48
|
echo ********************************************************
|
|
29
|
pause >nul
|
49
|
pause >nul
|
|
|
|
50
|
+ ::Appel de la routine :encoding avec le paramŠtre 4
|
|
30
|
call :encoding 4
|
51
|
call :encoding 4
|
|
31
|
)
|
52
|
)
|
|
32
|
if errorlevel 3 (
|
53
|
if errorlevel 3 (
|
|
|
|
|
|
|
66
|
|
87
|
|
|
67
|
:encoding
|
88
|
:encoding
|
|
68
|
echo.
|
89
|
echo.
|
|
|
|
90
|
+::Cr‚er le r‚pertoire des fichiers originaux
|
|
69
|
md Originaux
|
91
|
md Originaux
|
|
70
|
color 0a
|
92
|
color 0a
|
|
|
|
93
|
+::Boucle sur tous les fichiers du dossier en cours
|
|
|
|
94
|
+::%%a est le nom du fichier
|
|
71
|
for %%a in (*.*) do (
|
95
|
for %%a in (*.*) do (
|
|
72
|
call :encodingcheck %1 "%%a"
|
96
|
call :encodingcheck %1 "%%a"
|
|
73
|
)
|
97
|
)
|
|
|
|
98
|
+::Lors de l'ex‚cution, le goto amŠne le programme au label :end.
|
|
74
|
goto:end
|
99
|
goto:end
|
|
75
|
|
100
|
|
|
|
|
101
|
+::V‚rifie si le fichier peut ˆtre encod‚
|
|
76
|
:encodingcheck
|
102
|
:encodingcheck
|
|
77
|
set toencode="false"
|
103
|
set toencode="false"
|
|
78
|
set extension="%~x2"
|
104
|
set extension="%~x2"
|
|
|
|
105
|
+::Ci dessous une liste d'extensions correspondant … tous les formats vid‚os usuels
|
|
79
|
if %extension%==".mkv" set toencode="true"
|
106
|
if %extension%==".mkv" set toencode="true"
|
|
80
|
if %extension%==".MKV" set toencode="true"
|
107
|
if %extension%==".MKV" set toencode="true"
|
|
81
|
if %extension%==".avi" set toencode="true"
|
108
|
if %extension%==".avi" set toencode="true"
|
|
|
|
|
|
|
98
|
if %1==3 call :web %2
|
125
|
if %1==3 call :web %2
|
|
99
|
if %1==4 call :archives %2
|
126
|
if %1==4 call :archives %2
|
|
100
|
)
|
127
|
)
|
|
|
|
128
|
+::Le label :eof est pr‚defini et permet de retourner … l'endroit du code o— la routine a ‚t‚ appel‚e.
|
|
101
|
goto:eof
|
129
|
goto:eof
|
|
102
|
|
130
|
|
|
|
|
131
|
+::Ci dessous les commandes d'encodage qui font appel … ffmpeg v2.7.2 (https://www.ffmpeg.org/)
|
|
|
|
132
|
+::Liste des paramŠtres utilis‚s par les commandes :
|
|
|
|
133
|
+:: -i <input>
|
|
|
|
134
|
+:: Fichier original … encoder.
|
|
|
|
135
|
+:: -threads <number>
|
|
|
|
136
|
+:: Nombre de CPU utilis‚s pour r‚aliser l'encodage. Si 0, un maximum de CPU sont utilis‚s.
|
|
|
|
137
|
+:: -c:v <codec>
|
|
|
|
138
|
+:: Codec vid‚o, le JTX a choisi d'utiliser H.264 impl‚ment‚ par la librairie libx264.
|
|
|
|
139
|
+:: -b:v <number>
|
|
|
|
140
|
+:: Bitrate de la vid‚o en sortie, exprim‚ en bits.
|
|
|
|
141
|
+:: -r <number>
|
|
|
|
142
|
+:: Framerate de la vid‚o en sortie.
|
|
|
|
143
|
+:: -s <width>x<hright>
|
|
|
|
144
|
+:: R‚solution de la vid‚o en sortie, exprim‚e en pixels.
|
|
|
|
145
|
+:: -x264opts <options>
|
|
|
|
146
|
+:: Permet de sp‚cifier des options pour la libraire libx264. En l'occurence, on d‚termine
|
|
|
|
147
|
+:: ici le level de l'encodage H.264. Plus d'infos ici : https://fr.wikipedia.org/wiki/H.264#Niveaux.
|
|
|
|
148
|
+:: -pix_fmt <format>
|
|
|
|
149
|
+:: Format d'encodage des pixels. yuv420p est sp‚cifi‚ ici car sinon les vid‚os ne sont pas
|
|
|
|
150
|
+:: lisibles par Windows Media Player. Plus d'infos ici : https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=709.
|
|
|
|
151
|
+:: -c:a <codec>
|
|
|
|
152
|
+:: Codec audio de la vid‚o en sortie. Le JTX a choisi AAC.
|
|
|
|
153
|
+:: -strict <strictness>
|
|
|
|
154
|
+:: Le codec audio AAC ‚tant une fonctionnalit‚ exp‚rimentale pour ffmpeg 2.7.2, il est n‚cessaire
|
|
|
|
155
|
+:: de r‚gler ce paramŠtre sur experimental.
|
|
|
|
156
|
+:: -b:a <number>
|
|
|
|
157
|
+:: Bitrate de l'audio en sortie. Le JTX a choisi 192k.
|
|
|
|
158
|
+:: -y
|
|
|
|
159
|
+:: �crase automatiquement les fichiers en sortie s'ils existent d‚j… (pas de prompt).
|
|
103
|
|
160
|
|
|
104
|
:fullhd
|
161
|
:fullhd
|
|
105
|
title= ---- Encodeur du JTX ---- Encodage de %1 en FullHD
|
162
|
title= ---- Encodeur du JTX ---- Encodage de %1 en FullHD
|
|
106
|
move %1 Originaux/
|
163
|
move %1 Originaux/
|
|
107
|
-ffmpeg.exe -i Originaux/%1 -threads 0 -c:v libx264 -b:v 8M -maxrate 12M -r 25 -s 1920x1080 -x264opts level=4 -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k -y "%~np1.mp4"
|
|
|
|
|
|
164
|
+ffmpeg.exe -i Originaux/%1 -threads 0 -c:v libx264 -b:v 8M -r 25 -s 1920x1080 -x264opts level=4 -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k -y "%~np1.mp4"
|
|
108
|
goto:eof
|
165
|
goto:eof
|
|
109
|
:hd
|
166
|
:hd
|
|
110
|
title= ---- Encodeur du JTX ---- Encodage de %1 en HD
|
167
|
title= ---- Encodeur du JTX ---- Encodage de %1 en HD
|
|
111
|
move %1 Originaux/
|
168
|
move %1 Originaux/
|
|
112
|
-ffmpeg.exe -i Originaux/%1 -threads 0 -c:v libx264 -b:v 3M -maxrate 4.5M -r 25 -s 1280x720 -x264opts level=3.1 -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k -y "%~np1.mp4"
|
|
|
|
|
|
169
|
+ffmpeg.exe -i Originaux/%1 -threads 0 -c:v libx264 -b:v 3M -r 25 -s 1280x720 -x264opts level=3.1 -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k -y "%~np1.mp4"
|
|
113
|
goto:eof
|
170
|
goto:eof
|
|
114
|
:web
|
171
|
:web
|
|
115
|
title= ---- Encodeur du JTX ---- Encodage de %1 au format Web
|
172
|
title= ---- Encodeur du JTX ---- Encodage de %1 au format Web
|
|
116
|
move %1 Originaux/
|
173
|
move %1 Originaux/
|
|
117
|
-ffmpeg.exe -i Originaux/%1 -threads 0 -c:v libx264 -b:v 1.5M -maxrate 2.25M -r 25 -s 854x480 -x264opts level=3 -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k -y "%~np1.mp4"
|
|
|
|
|
|
174
|
+ffmpeg.exe -i Originaux/%1 -threads 0 -c:v libx264 -b:v 1.5M -r 25 -s 854x480 -x264opts level=3 -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k -y "%~np1.mp4"
|
|
118
|
goto:eof
|
175
|
goto:eof
|
|
119
|
:archives
|
176
|
:archives
|
|
120
|
title= ---- Encodeur du JTX ---- Encodage de %1 au format Archives
|
177
|
title= ---- Encodeur du JTX ---- Encodage de %1 au format Archives
|
|
121
|
move %1 Originaux/
|
178
|
move %1 Originaux/
|
|
122
|
-ffmpeg.exe -i Originaux/%1 -threads 0 -c:v libx264 -b:v 1.5M -maxrate 2.25M -r 25 -s 720x576 -x264opts level=3 -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k -y "%~np1.mp4"
|
|
|
|
|
|
179
|
+ffmpeg.exe -i Originaux/%1 -threads 0 -c:v libx264 -b:v 1.5M -r 25 -s 720x576 -x264opts level=3 -pix_fmt yuv420p -c:a aac -strict experimental -b:a 192k -y "%~np1.mp4"
|
|
123
|
goto:eof
|
180
|
goto:eof
|
|
124
|
|
181
|
|
|
125
|
|
182
|
|