I have a script that generates a text file with entries like:
-ss 5.5 -i "/path/vid 1.mp4" -t 3 "/path/vid out1.mp4"
But when I call ffmpeg with this string attached it fails. If I quote the variable then ffmpeg considers the entire string as a single option, error "Option not found". If I don't quote, then for some reason ffmpeg ignores the double quotes and reports "/path/vid :No such file or directory.
Even though it prints the input correctly as -i "/path/vid 1.mp4".
Replacing the double quotes around the filenames with single quotes doesn't help. But when I pass the string to zenity and then manually copy it into the terminal, it works:
zenity --entry --entry-text "ffmpeg -nostdin $line2"
So I tried assigning the entire command to a var and then running bash $var or exec $var, but no luck. Assigning it to an alias doesn't work either: "command not found"
Solution by Joan Estaban:
echo $stringvar | xargs ffmpeg
A short full script demonstrating the problem:
#!/bin/bash
fffile="/home/vume5/Desktop/dwhelper/bud grafting animation.mp4"
line="-ss 4.920000 -i \"$fffile\" -t 60.000000 -map 0 -c:v copy -c:a copy \"$fffile.cut.mkv\""
zenity --entry --entry-text "$line"
ffmpeg $line
read dummy
ffmpeg -ss 5.5 -i "/path/vid 1.mp4" -t 3 "/path/vid out1.mp4"work?-ss 5.5 -i "\"/path/vid 1.mp4\"" -t 3 "\"/path/vid out1.mp4\""cat my_params.txt | xargs -l ffmpeg