Advertisement
sxiii

FFMPEG Combine MP4 without reencoding

May 11th, 2022
786
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.75 KB | None | 0 0
  1. #!/bin/bash
  2. # This script can be used to combine multiple FFMPEG files into one without re-encoding
  3. # It lists all the *mp4 files in current directory and then builds a file list, passing it to FFMPEG
  4. # FFMPEG does concatenation and then we remove the file list
  5. # Requirements: FFMPEG, Linux, Bash
  6. # Save to ffmpeg-combine-noreencoding.sh, do `chmod +x ffmpeg*sh`, then run like `./ffmpeg-combine-noreencoding.sh`
  7. # * Please run only in folder with the FFMPEG files you want to combine
  8. # * Files will be combined in alphabetical way
  9. # * Process takes some time, output filename is normally always output.mp4
  10.  
  11. for item in $(ls *mp4); do
  12.     echo "file '$PWD/$item'" >> filelist.md
  13. done
  14.  
  15. ffmpeg -f concat -safe 0 -i filelist.md -c copy output.mp4
  16.  
  17. rm filelist.md
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement