Réparer une synchronisation audio/video
Il arrive qu'une vidéo aie un décalage A/V. Comment réparer facilement cette désynchronisation ?
On prend l'exemple d'une vidéo YouTube qu'on va essayer de réparer.
Tout d'abord on la récupère localement avec yt-dlp
.
Liste des formats disponibles
1% yt-dlp "https://www.youtube.com/watch?v=MbiezAb_s-4" -F
2[youtube] Extracting URL: https://www.youtube.com/watch?v=MbiezAb_s-4
3[youtube] MbiezAb_s-4: Downloading webpage
4[youtube] MbiezAb_s-4: Downloading ios player API JSON
5[youtube] MbiezAb_s-4: Downloading android player API JSON
6WARNING: [youtube] YouTube said: ERROR - Precondition check failed.
7WARNING: [youtube] HTTP Error 400: Bad Request. Retrying (1/3)...
8[youtube] MbiezAb_s-4: Downloading android player API JSON
9WARNING: [youtube] YouTube said: ERROR - Precondition check failed.
10WARNING: [youtube] HTTP Error 400: Bad Request. Retrying (2/3)...
11[youtube] MbiezAb_s-4: Downloading android player API JSON
12WARNING: [youtube] YouTube said: ERROR - Precondition check failed.
13WARNING: [youtube] HTTP Error 400: Bad Request. Retrying (3/3)...
14[youtube] MbiezAb_s-4: Downloading android player API JSON
15WARNING: [youtube] YouTube said: ERROR - Precondition check failed.
16WARNING: [youtube] Unable to download API page: HTTP Error 400: Bad Request (caused by <HTTPError 400: Bad Request>); please report this issue on https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using yt-dlp -U
17[youtube] MbiezAb_s-4: Downloading m3u8 information
18[info] Available formats for MbiezAb_s-4:
19ID EXT RESOLUTION FPS CH │ FILESIZE TBR PROTO │ VCODEC VBR ACODEC ABR ASR MORE INFO
20────────────────────────────────────────────────────────────────────────────────────────────────────────────────
21sb3 mhtml 48x27 0 │ mhtml │ images storyboard
22sb2 mhtml 80x45 0 │ mhtml │ images storyboard
23sb1 mhtml 160x90 0 │ mhtml │ images storyboard
24sb0 mhtml 320x180 0 │ mhtml │ images storyboard
25233 mp4 audio only │ m3u8 │ audio only unknown Default
26234 mp4 audio only │ m3u8 │ audio only unknown Default
27139 m4a audio only 2 │ 33.06MiB 49k https │ audio only mp4a.40.5 49k 22k low, m4a_dash
28249 webm audio only 2 │ 35.10MiB 52k https │ audio only opus 52k 48k low, webm_dash
29250 webm audio only 2 │ 46.11MiB 68k https │ audio only opus 68k 48k low, webm_dash
30140 m4a audio only 2 │ 87.73MiB 129k https │ audio only mp4a.40.2 129k 44k medium, m4a_dash
31251 webm audio only 2 │ 90.15MiB 133k https │ audio only opus 133k 48k medium, webm_dash
32602 mp4 256x144 15 │ ~ 73.26MiB 106k m3u8 │ vp09.00.10.08 106k video only
33269 mp4 256x144 30 │ ~150.91MiB 217k m3u8 │ avc1.4D400C 217k video only
34160 mp4 256x144 30 │ 57.26MiB 85k https │ avc1.4D400C 85k video only 144p, mp4_dash
35603 mp4 256x144 30 │ ~127.70MiB 184k m3u8 │ vp09.00.11.08 184k video only
36278 webm 256x144 30 │ 59.90MiB 88k https │ vp09.00.11.08 88k video only 144p, webm_dash
37229 mp4 426x240 30 │ ~266.55MiB 384k m3u8 │ avc1.4D4015 384k video only
38133 mp4 426x240 30 │ 131.92MiB 195k https │ avc1.4D4015 195k video only 240p, mp4_dash
39604 mp4 426x240 30 │ ~223.48MiB 322k m3u8 │ vp09.00.20.08 322k video only
40242 webm 426x240 30 │ 120.37MiB 178k https │ vp09.00.20.08 178k video only 240p, webm_dash
41230 mp4 640x360 30 │ ~615.26MiB 887k m3u8 │ avc1.4D401E 887k video only
42134 mp4 640x360 30 │ 265.68MiB 392k https │ avc1.4D401E 392k video only 360p, mp4_dash
4318 mp4 640x360 30 2 │ 332.47MiB 491k https │ avc1.42001E mp4a.40.2 44k 360p
44605 mp4 640x360 30 │ ~401.59MiB 579k m3u8 │ vp09.00.21.08 579k video only
45243 webm 640x360 30 │ 196.88MiB 291k https │ vp09.00.21.08 291k video only 360p, webm_dash
46231 mp4 854x480 30 │ ~ 1.06GiB 1561k m3u8 │ avc1.4D401F 1561k video only
47135 mp4 854x480 30 │ 532.35MiB 786k https │ avc1.4D401F 786k video only 480p, mp4_dash
48606 mp4 854x480 30 │ ~662.15MiB 954k m3u8 │ vp09.00.30.08 954k video only
49244 webm 854x480 30 │ 349.23MiB 515k https │ vp09.00.30.08 515k video only 480p, webm_dash
50232 mp4 1280x720 30 │ ~ 1.85GiB 2732k m3u8 │ avc1.64001F 2732k video only
51136 mp4 1280x720 30 │ 1.07GiB 1617k https │ avc1.64001F 1617k video only 720p, mp4_dash
52609 mp4 1280x720 30 │ ~ 1.18GiB 1738k m3u8 │ vp09.00.31.08 1738k video only
53247 webm 1280x720 30 │ 628.63MiB 928k https │ vp09.00.31.08 928k video only 720p, webm_dash
54270 mp4 1920x1080 30 │ ~ 3.51GiB 5186k m3u8 │ avc1.640028 5186k video only
55137 mp4 1920x1080 30 │ 2.03GiB 3074k https │ avc1.640028 3074k video only 1080p, mp4_dash
56614 mp4 1920x1080 30 │ ~ 1.87GiB 2759k m3u8 │ vp09.00.40.08 2759k video only
57248 webm 1920x1080 30 │ 1.06GiB 1606k https │ vp09.00.40.08 1606k video only 1080p, webm_dash
Grabber les flux
On choisit les flux video et audio de meilleure qualité, ID 140
pour l'audio, ID 614
pour la vidéo.
1yt-dlp "https://www.youtube.com/watch?v=MbiezAb_s-4" -f 614,140
Synchro
La commande suivante va retarder la vidéo de 425ms, sans réencodage (donc très rapide et sans perte). On a estimé cette valeur manuellement avec plusieurs essais de lecture.
1ffmpeg -y -itsoffset 00:00:00.425 -i video.mp4 -i audio.m4a -c:a copy -c:v copy -map 0:v:0 -map 1:a:0 output.mp4
Ressources
comments powered by Disqus