sxiii icon

FFMPEG Combine MP4 without reencoding

sxiii | PRO | 05/11/22 11:20:04 AM UTC | 0 ⭐ | 1150 👁️ | Never ⏰ | []
Bash |

750 B

|

None

|

0 👍

/

0 👎

#!/bin/bash
# This script can be used to combine multiple FFMPEG files into one without re-encoding
# It lists all the *mp4 files in current directory and then builds a file list, passing it to FFMPEG
# FFMPEG does concatenation and then we remove the file list
# Requirements: FFMPEG, Linux, Bash
# Save to ffmpeg-combine-noreencoding.sh, do `chmod +x ffmpeg*sh`, then run like `./ffmpeg-combine-noreencoding.sh`
# * Please run only in folder with the FFMPEG files you want to combine
# * Files will be combined in alphabetical way
# * Process takes some time, output filename is normally always output.mp4
 
for item in $(ls *mp4); do
    echo "file '$PWD/$item'" >> filelist.md
done
 
ffmpeg -f concat -safe 0 -i filelist.md -c copy output.mp4
 
rm filelist.md

Comments