Linux Mastering Development Ubuntu

shell download part video with ffmpeg

I can’t get this right
must be a problem with double quotes

var=$(xclip -o)

if [ -z $var ]; then  
    echo 'copia url a descargar al portapapeles'  

printf "(1) download part of video without audio\n"
printf "(2) download part of audio\n"
echo -n 'opcion: '
read opcion
 case $opcion in
     "1") c=$(youtube-dl -g $var | awk '{ if(NR==1) print $0 }' | sed 's/^/"/;s/$/"/')  && echo -n 'start time: ' && read segundos && echo -n 'duration: ' && read duration &&  ffmpeg -i $c -ss $segundos -t $duration probe.mp4;;  
     "2") b=$(youtube-dl -g $var | awk '{ if(NR==2) print $0 }' | sed 's/^/"/;s/$/"/')  && echo $b && ffmpeg -ss 0 -i $b  -t 10 probe.mp3;;  

Leave a Reply

Your email address will not be published. Required fields are marked *