Prochaine révision | Révision précédente |
informatique:multimedia:ffmpeg [2017/04/17 21:07] – créée bn8 | informatique:multimedia:ffmpeg [2023/07/10 15:19] (Version actuelle) – [Supprimer la bande son d'une vidéo] bn8 |
---|
* Le paramètre ''%%-t 00:02:00%%'' permet de définir la durée de capture (2 minutes dans cet exemple). | * Le paramètre ''%%-t 00:02:00%%'' permet de définir la durée de capture (2 minutes dans cet exemple). |
| |
<note>En utilisant l'adaptateur PAL<=> NTSC, il faut ajouter un //crop//. Pour cela, ajouter un //filter// dans le paramètre //-filter:v// en le séparant avec une virgule : ''%%crop=654:446:38:30%%''</note> | <note>En utilisant l'adaptateur PAL<=> NTSC, il faut ajouter un //crop//. Pour cela, ajouter un //filter// dans le paramètre //-filter:v// en le séparant avec une virgule : ''%%crop=654:446:38:30%%'' (avec : //w:h:top_x:top_y //)</note> |
| |
===== Découper une vidéo existante ===== | ===== Découper une vidéo existante ===== |
* Le paramètre ''%%-ss 00:00:15%%'' permet de découper à partir de 15 secondes | * Le paramètre ''%%-ss 00:00:15%%'' permet de découper à partir de 15 secondes |
* Le paramètre ''%%-t 00:01:27%%'' permet de découper pour une durée de 1m27s | * Le paramètre ''%%-t 00:01:27%%'' permet de découper pour une durée de 1m27s |
| |
| ===== Extraire une image de la vidéo ===== |
| |
| <code bash>ffmpeg -i in.mp4 -ss 00:01:14.435 -vframes 1 out.png</code> |
| |
| * Le paramètre ''%%-ss 00:00:15%%'' permet de choisir quelle image extraire |
| |
| ===== Supprimer la bande son d'une vidéo ===== |
| |
| <code bash>ffmpeg -i in.mp4 -c copy -an out.mp4</code> |
| |
| * Le paramètre ''%%-an%%'' permet de désactiver l'audio de la vidéo |
| |
| ===== Conversion WEBM vers GIF ===== |
| |
| <code bash> |
| function webm2gif() { |
| TMP=$(mktemp --suffix .png) |
| ffmpeg -y -i "$1" -vf palettegen $TMP |
| ffmpeg -y -i "$1" -i $TMP -filter_complex paletteuse -r 10 "${1%.webm}.gif" |
| rm $TMP |
| } |
| </code> |
| |
| **Source :** https://askubuntu.com/a/1350795 |
| ===== Tuto: télécharger une vidéo et ses sous-titres depuis Youtube et incruster les sous-titres dans la vidéo ===== |
| |
| * Lister les formats disponibles (avec ''yt-dlp'') : <code bash>$ yt-dlp -F 'https://www.youtube.com/watch?v=gSDtNkKPiDg' |
| [youtube] Extracting URL: https://www.youtube.com/watch?app=desktop&v=gSDtNkKPiDg |
| [youtube] gSDtNkKPiDg: Downloading webpage |
| [youtube] gSDtNkKPiDg: Downloading android player API JSON |
| [info] Available formats for gSDtNkKPiDg: |
| ID EXT RESOLUTION FPS CH │ FILESIZE TBR PROTO │ VCODEC VBR ACODEC ABR ASR MORE INFO |
| ────────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
| sb2 mhtml 48x27 0 │ mhtml │ images storyboard |
| sb1 mhtml 80x45 0 │ mhtml │ images storyboard |
| sb0 mhtml 160x90 0 │ mhtml │ images storyboard |
| 599 m4a audio only 2 │ 2.25MiB 31k dash │ audio only mp4a.40.5 31k 22k ultralow, m4a_dash |
| 600 webm audio only 2 │ 2.46MiB 34k dash │ audio only opus 34k 48k ultralow, webm_dash |
| 139 m4a audio only 2 │ 3.56MiB 49k dash │ audio only mp4a.40.5 49k 22k low, m4a_dash |
| 249 webm audio only 2 │ 3.63MiB 50k dash │ audio only opus 50k 48k low, webm_dash |
| 250 webm audio only 2 │ 4.68MiB 64k dash │ audio only opus 64k 48k low, webm_dash |
| 140 m4a audio only 2 │ 9.45MiB 129k dash │ audio only mp4a.40.2 129k 44k medium, m4a_dash |
| 251 webm audio only 2 │ 9.26MiB 127k dash │ audio only opus 127k 48k medium, webm_dash |
| 17 3gp 176x144 6 1 │ 5.75MiB 79k https │ mp4v.20.3 79k mp4a.40.2 0k 22k 144p |
| 597 mp4 256x144 13 │ 2.39MiB 33k dash │ avc1.4d400b 33k video only 144p, mp4_dash |
| 598 webm 256x144 13 │ 1.92MiB 26k dash │ vp9 26k video only 144p, webm_dash |
| 394 mp4 256x144 25 │ 4.80MiB 66k dash │ av01.0.00M.08 66k video only 144p, mp4_dash |
| 160 mp4 256x144 25 │ 5.56MiB 76k dash │ avc1.4d400c 76k video only 144p, mp4_dash |
| 278 webm 256x144 25 │ 6.59MiB 90k dash │ vp9 90k video only 144p, webm_dash |
| 395 mp4 426x240 25 │ 10.36MiB 142k dash │ av01.0.00M.08 142k video only 240p, mp4_dash |
| 133 mp4 426x240 25 │ 9.82MiB 134k dash │ avc1.4d4015 134k video only 240p, mp4_dash |
| 242 webm 426x240 25 │ 13.31MiB 182k dash │ vp9 182k video only 240p, webm_dash |
| 396 mp4 640x360 25 │ 20.70MiB 284k dash │ av01.0.01M.08 284k video only 360p, mp4_dash |
| 134 mp4 640x360 25 │ 19.56MiB 268k dash │ avc1.4d401e 268k video only 360p, mp4_dash |
| 18 mp4 640x360 25 2 │ 48.86MiB 669k https │ avc1.42001E 669k mp4a.40.2 0k 44k 360p |
| 243 webm 640x360 25 │ 24.43MiB 335k dash │ vp9 335k video only 360p, webm_dash |
| 397 mp4 854x480 25 │ 37.08MiB 508k dash │ av01.0.04M.08 508k video only 480p, mp4_dash |
| 135 mp4 854x480 25 │ 31.03MiB 425k dash │ avc1.4d401e 425k video only 480p, mp4_dash |
| 244 webm 854x480 25 │ 38.86MiB 532k dash │ vp9 532k video only 480p, webm_dash |
| 22 mp4 1280x720 25 2 │ ~ 72.10MiB 965k https │ avc1.64001F 965k mp4a.40.2 0k 44k 720p |
| 398 mp4 1280x720 25 │ 67.00MiB 918k dash │ av01.0.05M.08 918k video only 720p, mp4_dash |
| 136 mp4 1280x720 25 │ 61.02MiB 836k dash │ avc1.4d401f 836k video only 720p, mp4_dash |
| 247 webm 1280x720 25 │ 76.04MiB 1042k dash │ vp9 1042k video only 720p, webm_dash |
| 399 mp4 1920x1080 25 │ 134.37MiB 1841k dash │ av01.0.08M.08 1841k video only 1080p, mp4_dash |
| 137 mp4 1920x1080 25 │ 239.68MiB 3284k dash │ avc1.640028 3284k video only 1080p, mp4_dash |
| 248 webm 1920x1080 25 │ 163.11MiB 2235k dash │ vp9 2235k video only 1080p, webm_dash</code> |
| |
| * Télécharger celui que vous voulez (**attention au format //video only//**, avec ''yt-dlp'') : <code bash>yt-dlp --write-sub --write-auto-sub --sub-lang "en.*" 'https://www.youtube.com/watch?v=gSDtNkKPiDg'</code> |
| * Lancer l'incrustation des sous-titres (avec ''ffmpeg'') : <code bash>ffmpeg -i 'The WEIGHTLESS Machine [gSDtNkKPiDg].mp4' -vf subtitles="The\ WEIGHTLESS\ Machine\ \[gSDtNkKPiDg\].en-orig.vtt" The\ WEIGHTLESS\ Machine.mp4</code> |
| |
| <note tip>Pour traduire les sous-titres, l'outil en ligne [[https://www.syedgakbar.com/projects/dst|Online Subtitle Translator]] fait très bien le job.</note> |
| |
| |
| |