FFMPEG Snippets

I've been using ffmpeg a lot these last days and i have needed to use it to do all kinds of processing on videos. Here i will dump some ffmpeg command snippets that i have used and that someone may find useful.

Split a video/audio in segments of x seconds

ffmpeg -i {input_filename} -f segment -segment_time {time_in_seconds} -c copy {outname}%03d.{ext}

Speed up an audio file

ffmpeg -i {input_audio} -filter:a "atempo={time*}" {output_filename}

* to double the speed, the time would be 2.0.

Replace the audio track of a video file

First you need to strip the audio of the original video file

ffmpeg -i {input_filename} -codec copy -an {output_filename}

Then you can add your audio track by typing:

ffmpeg -i {input_video_file}.mp4 -i {input_audio_file} -shortest -c:v copy -c:a aac -b:a 256k {output_filename}.mp4

<- Home