FFmpeg Useful Commands
19 Mar 2016
Download and install ffmpeg
Merging audio and video
$ ffmpeg -i video.mp4 -i audio.m4a -c:v copy -c:a copy output.mp4
$ ffmpeg -i videoplayback.webm -i videoplayback.m4a -c:v copy -c:a copy output.mkv
Split video with specific timestamp
$ ffmpeg -i output.mp4 -ss 0 -t 60 first-60-sec.mp4
Replace old audio stream with target audio stream
$ ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 output.mp4
Concatenate multipe video files
$ cat concat.txt
file '/path/to/video1.mp4'
file '/path/to/video2.mp4'
file '/path/to/video3.mp4'
$ ffmpeg -f concat -i concat.txt -c copy output.mp4