capsula-gemini/source/notes/ffmpeg.gmi

76 lines
1.2 KiB
Plaintext
Raw Normal View History

2021-08-26 17:40:14 -05:00
## ffmpeg
1] Cortar un video
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```Cortar un video
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
ffmpeg -i ENTRADA.mp4 -ss 00:00:00 -to 00:10:00 -c copy SALIDA.mp4
-ss = empezar en
-to = terminar en
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```
2] Descargar y fusionar un video desde un enlace m3u8, no debe estar encriptado.
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```Descargar y fusionar un video
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
ffmpeg -i "URL.m3u8" -c copy -bsf:a aac_adtstoasc output.mp4
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```
3] Escalar un video a la mitad
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```Escalar un video
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 -vf "scale=iw/2:ih/2" output.mp4
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```
4] Concatenar videos.
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```Concatenar videos
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```
El archivo files.txt debe contener las rutas de los videos en el formato:
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
file 'path/video1.mp4'
file 'path/video2.mp4'
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```
5] Extraer el audio de un video
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```Extraer el audio
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
ffmpeg -i video.mp4 -q:a 0 -map a audio.ogg
2022-02-10 22:44:33 -06:00
```
2023-10-08 18:00:33 -06:00
6] Extraer subtítulos de un video
2022-02-10 22:44:33 -06:00
2023-10-08 18:00:33 -06:00
Primero extrae los lenguajes y sus índices
2022-02-10 22:44:33 -06:00
2021-08-26 17:40:14 -05:00
```
2022-02-10 22:44:33 -06:00
ffprobe -v error -of json VIDEO.mkv -of json -show_entries "stream=index:stream_tags=language" -select_streams s
```
Ahora extrae por índice:
```
ffmpeg -i VIDEO.mkv -map "0:2" subtitulo.eng.srt
```
2021-08-26 17:40:14 -05:00
=> gemini://elmau.net/chuletas.gmi Regresar el índice
=> gemini://elmau.net Regresar el inicio