[NetBehaviour] My name is ${NAME} and I am ${IDENTIFIER}

James Morris james at jwm-art.net
Tue May 10 23:24:48 CEST 2016


see attached BASH script

- safe for work
- requires youtube-dl
- requires ffmpeg*

* the linux distro you use may not provide ffmpeg but some fork of it, 
script might need adaption to work with this but i wouldn't know about 
that. i'm SO sorry.

damn, i've said too much... but... i was going to get the script to 
download various accelerationist related images and make a slideshow to 
accompany the sounds but it was too much work for zero payoff. i'm SO sorry.
-------------- next part --------------
#!/bin/bash

declare -a STARTS
declare -a LENGTH
declare -a IMGS
declare -a IMGSDUR

YTID="3DuCIGvsbMA"
IN="$(youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' https://www.youtube.com/watch?v=$YTID --get-filename)"

if [[ ! -e "$IN" ]]; then
    youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' https://www.youtube.com/watch?v=$YTID
fi

OUTN="nothing"
OUTE="${IN##*.}"

N=0

while [[ $N -lt 25 ]]
do
    FILE+=("$IN"); START+=("00:01:11"); LENGTH+=("00:00:01");
    N=$((N+1))
done

N=0

for F in "${FILE[@]}"
do
  OUT=$(printf "${OUTN}%02d.${OUTE}" $N)
  if [[ ${START[$N]} ]]
  then
    echo  "Clip $N: '${FILE[$N]}' start ${START[$N]} length ${LENGTH[$N]} --> ${OUT}"
    if [[ ! -e "$OUT" ]]; then
        ffmpeg -y -ss "${START[$N]}" -i "${FILE[$N]}" -t "${LENGTH[$N]}" -vcodec copy -acodec copy "$OUT"
    fi
    FILES+=("$OUT")
  fi
  N=$((N+1))
done

ffmpeg -y -safe 0 -f concat -i <(printf "file '$PWD/%s'\n" "${FILES[@]}") -c copy "${OUTN}.${OUTE}"


More information about the NetBehaviour mailing list