Advertisement
Guest User

FFmpeg concatinator (revision 2022-10-30)

a guest
Oct 29th, 2022
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.88 KB | Source Code | 0 0
  1. ffmpeg_concat() {
  2.  
  3.  timestamp=$(date "+%Y%m%d%H%M%S")
  4.   # Unlike in JavaScript, no spaces may surround the "=" equals sign to set a variable.
  5.  
  6. # generate file list
  7.  for path in $@; do
  8.   echo "file '$path' " >>ffmpeg_concat.$timestamp.txt
  9.    # ffmpeg only supports apostrophes, no quotation marks.
  10.  done
  11.  
  12. # ask user for output file extension to specify which container format should be used by FFmpeg
  13. printf "Output file extension: "
  14. read output_extension
  15.  
  16. # put it together
  17. ffmpeg -f concat -safe 0 -i ffmpeg_concat.$timestamp.txt -c copy ffmpeg_concat.$timestamp.$output_extension
  18.  # -safe 0  allows concatinating files outside the current working directory
  19.  # -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.
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement