send2pipe() {
      # Open the pipe permanently
      exec 7<>outpipe
      # Decode and send every raw frame to the pipe 
      for l in $(ls *avi); do ffmpeg -nostdin -i $l -an -filter:v fps=fps=5 -f rawvideo pipe:1 > outpipe 2> /dev/null ; done &
      # Close the pipe (aka send EOF), which causes the encoding app to terminate
      exec 7>&-
    # Create the pipe
    mkfifo outpipe
    # Start sending videos to the pipe in the background
    send2pipe &
    # Encode the frames in the pipe to a single video
    ffmpeg -fflags +genpts -f rawvideo -s:v 1280x720 -r 5 -i outpipe -an -c:v libx264 -preset ultrafast -crf 35 -y output.mkv
    # Remove the pipe
    rm outpipe
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.