Skip to content

Instantly share code, notes, and snippets.

@DavidEGrayson
Last active October 5, 2023 16:15
Show Gist options
  • Save DavidEGrayson/4c7a11861a46bc4101c4f01af1907891 to your computer and use it in GitHub Desktop.
Save DavidEGrayson/4c7a11861a46bc4101c4f01af1907891 to your computer and use it in GitHub Desktop.
ffmpeg commands to extract AAC audio from an MP4, edit it, and replace it
ffprobe foo.mp4 # Make sure the audio stream is aac.
ffmpeg -i foo.mp4 -vn -acodec copy foo.aac
ffmpeg -i foo.aac -acodec pcm_s16le foo.wav
# Edit foo.wav with audacity, save to foo_edited.wav.
ffmpeg -i foo_edited.wav -acodec aac foo_edited.aac
ffmpeg -i foo.mp4 -codec copy -an foo_silent.mp4
ffmpeg -i foo_silent.mp4 -i foo_edited.aac -shortest -c:v copy -c:a aac foo_edited.mp4
# Reduce file size and remove sounds
ffmpeg -i foo.mp4 -vcodec libx264 -crf 28 -an foo_out.mp4
# Extract some audio from a video
ffmpeg -i foo.mp4 -ss 3:50.2 -t 2.4 -vn output1.mp4
# Crop a video in time and scale it to 1080p
ffmpeg -ss 00:01:00 -to 00:00:10 -i foo.mp4 -vf scale=1920:-1 output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment