Skip to content

Instantly share code, notes, and snippets.

@waltercruz
Created November 3, 2016 15:00
Show Gist options
  • Save waltercruz/8f66c6169cc361159f503f2313f5f498 to your computer and use it in GitHub Desktop.
Save waltercruz/8f66c6169cc361159f503f2313f5f498 to your computer and use it in GitHub Desktop.
#!/bin/bash
audio_duration=$(ffprobe -i ${1} -show_entries format=duration -v quiet -of csv="p=0")
video_duration=$(ffprobe -i ${2} -show_entries format=duration -v quiet -of csv="p=0")
n_loops=$(echo "(${audio_duration} / ${video_duration}) + 1"|bc)
ffmpeg -i ${1} -f concat -i <(for i in {1..${n_loops}}; do printf "file '%s'\n" ${2}; done) -c:v copy -c:a copy -shortest ${3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment