Skip to content

Instantly share code, notes, and snippets.

@mikaelz
Created July 17, 2016 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikaelz/5b82b2e38b87e737601025d0c3885c73 to your computer and use it in GitHub Desktop.
Save mikaelz/5b82b2e38b87e737601025d0c3885c73 to your computer and use it in GitHub Desktop.
Generate .pls playlist for .mp4 files in the current directory
#!/bin/bash
count=1
echo "[playlist]" > ${PWD##*/}.pls
for v in *.mp4; do
echo "File$count=$v" >> ${PWD##*/}.pls
echo -n "Length$count=" >> ${PWD##*/}.pls
count=$((count+1))
ffprobe -i $v -show_entries format=duration -v quiet -of csv="p=0" >> ${PWD##*/}.pls
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment