[小技巧] ffmpeg从视频当中提取音频,并串联合并

Problem Definition

  • 如题

Solution

# 从视频当中提取音频
ffmpeg -i movie-1.mp4 -vn -acodec copy ~/tmp/movie-1.m4a
ffmpeg -i movie-2.mp4 -vn -acodec copy ~/tmp/movie-2.m4a

# 串联合并音频
ffmpeg -f concat -safe 0 -i <(printf "file '$PWD/movie-1.m4a'\nfile '$PWD/movie-2.m4a'\n") -c copy movie.m4a

Leave a Reply