Merge flv file by FFmpeg


Merge file by FFmpeg on Mac

I need to merge some flv file on macOS.

01.Install FFmpeg by Homebrew

Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL"

Install FFmpeg

brew install ffmpeg

02. Get & fix file list

1. Open Terminal and change file folder where flv files are.

Make a text file list by ls command.

ls *.flv >>filelist.txt

2. Fix file list

vi filelist.txt #Open file By VIM
:%s/^/file '.\/                #add "file './" at the head part for each line
:%s/$/'                 #add "'" at the end part for each line

And delete all line without flv file by ddcommand.

(Or you can just open the file in Finder and edit file by the way you like)

3. Merge file

ffmpeg -f concat -safe 0 -i ./filelist.txt -c copy output.mp4