FFMPEG 进阶指南/连接
外观
利用此脚本可以将多个视频组合成一个文件。该过程使用 -c copy
参数,这意味着视频文件构建自已有的视频流,并且不需要处理器密集型重新编码。
ffmpeg_concat() { timestamp=$(date "+%Y%m%d%H%M%S") # Unlike in JavaScript, no spaces may surround the "=" equals sign to set a variable. # generate file list for path in $@; do echo "file '$path' " >>ffmpeg_concat.$timestamp.txt # ffmpeg only supports apostrophes, no quotation marks. done # ask user for output file extension to specify which container format should be used by FFmpeg printf "Output file extension: " read output_extension # put it together ffmpeg -f concat -safe 0 -i ffmpeg_concat.$timestamp.txt -c copy ffmpeg_concat.$timestamp.$output_extension # -safe 0 allows concatinating files outside the current working directory # -c copy passes through the existing video and audio streams without re-encoding it and only multiplexes it, making the process take only a fraction of the time since disk reading/writing speeds are the only limitation. }