---
# System prepended metadata

title: ffmpg

---

# ffmpg

- ###### Adicionar audio a video - ffmpeg
	- `ffmpeg -i tela.mp4 -i a.mp3 -map 0:v -map 1:a -codec copy -shortest aev.mp4`
- ###### escalar video - ffmpeg
	- `ffmpeg -i input.mp4 -vf scale=1920x1080:flags=lanczos output_1080p.mp4`
- ###### truncar vídeo - ffmpeg
	- `ffmpeg -ss 00:00:00 -t 00:30:00 -i input.ext -vcodec copy -acodec copy output1.ext`
-
- ##### converter gif em mp4 - ffmpeg
	- `ffmpeg -i animated.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.mp4`
- ##### extrair apenas vídeo - ffmpeg
	- `ffmpeg -i video_with_audio.mkv -map 0:0 -c copy -vbsf hevc_mp4toannexb just_video.mkv`


- ##### mudar velocidade de vídeo/audio

    - Use  `setpts` e `atempo` para vídeo e áudio  no **ffmpeg**
	
  ```
  ffmpeg -i input-video.mp4 -vf "setpts=0.68*PTS" -filter:a "atempo=1.467" output-video.mp4
  ```
	- ie: setpts=0.5  atempo=2.0
- [https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video](https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video)
- `Audio value needed = 1 / Video value`