Skip to content

Instantly share code, notes, and snippets.

@jrichardsz
Last active April 6, 2024 15:45
Show Gist options
  • Save jrichardsz/6e485431f858442a69914f6d1f1e4430 to your computer and use it in GitHub Desktop.
Save jrichardsz/6e485431f858442a69914f6d1f1e4430 to your computer and use it in GitHub Desktop.
ffmpeg snippets collection

image

Fade in first 15 seconds of audio:

afade=t=in:ss=0:d=15

Fade out last 25 seconds of a 900 seconds audio:

afade=t=out:st=875:d=25

https://stackoverflow.com/a/27913617/3957754

ffmpeg -i audio.mp3 -af 'afade=t=in:ss=0:d=3,afade=t=out:st=27:d=3' out.mp3

Fade out start approx from second 4

ffmpeg -i one.wav -af 'afade=t=out:st=0:d=4' out.mp3
ffmpeg -i video.mp4 -i audio.wav -map 0:v -map 1:a -c:v copy -shortest output.mp4 
ffmpeg -i this_november_f.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts this_november_f.ts
ffmpeg -i slide_sao_tribute_f.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts slide_sao_tribute_f.ts
ffmpeg -i beta1.0.4_23_Secs.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts beta1.0.4_23_Secs.ts
ffmpeg -i "concat:this_november_f.ts|slide_sao_tribute_f.ts|beta1.0.4_23_Secs.ts" -c copy output.mp4
from second 0 + 55 seconds

ffmpeg -ss 0 -t 55 -i ini.mp4 -acodec copy parte1.mp4

from second 55 until the end

ffmpeg -ss 55 -i ini.mp4 -acodec copy parte2.mp4

from second 55 + 59 seconds

ffmpeg -ss 55 -t 59 -i ini.mp4 -acodec copy parte2.mp4

from second 52 and 33.9 seconds

ffmpeg -ss 52 -i VID-20221127-WA0008.mp4 -c copy -t 33.9 output.mp4

ffmpeg -ss 0 -t 3 -i notification.wav notification-3seg.wav

ffprobe -loglevel error -show_streams -i foo.wav

ffmpeg -loop 1 -i image.png -c:v libx264 -t 15 -pix_fmt yuv420p -vf scale=320:240 out.mp4

https://github.com/BtbN/FFmpeg-Builds/releases
ffmpeg -i input.mp3 -af 'volume=1.5' output.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment