Piping output of youtube-dl to a script using ffmpeg looks ok using echo but returns an error when executing
<p>I am trying to use youtube-dl to get the urls of some videos and then pipe the resulting urls into the input of my script. So in my terminal I do</p>

<pre><code>youtube-dl --ignore-config -iga ~/Desktop/youtube/videolist.txt | myscript.sh
</code></pre>

<p>In my script I define things as </p>

<pre><code>command='ffmpeg'        
inputArgs='-i'              
outputArgs='-c:v libx264 -preset ultrafast -qp 0'       
directory="${HOME}/Desktop/Videos/"
output="video${count}"      
extension='mp4'         
</code></pre>

<p>I test it with <code>echo</code> to make sure everything appears in the correct order.</p>

<pre><code>echo "${command}" "${inputArgs}" "${input}" "${outputArgs}" \
"${directory}""${output}${count}"."${extension}"
</code></pre>

<p>And the output from that looks correct. But when I try to run the same thing without the preceding <code>echo</code> command, i.e.,   </p>

<pre><code>"${command}" "${inputArgs}" "${input}" "${outputArgs}" \
"${directory}""${output}${count}"."${extension}"
</code></pre>

<p>I get an error message that says</p>

<blockquote>
  <p>At least one output file must be specified.</p>
</blockquote>

<p>So it seems pretty obvious to me that I'm doing something wrong  when attempting to execute it.</p>

<p>I have tried:</p>

<ul>
<li>quoting the entire line as a whole</li>
<li>quoting different sections together</li>
<li>using the <code>exec</code> command in front of everything</li>
</ul>

<p>No matter what I do, an error occurs at some point in the process. I know it's something simple I'm doing wrong. Would someone please enlighten me as to what that might be?</p>

<p>I feel very strongly that the <code>.</code> shouldn't just be in the middle of everything like that, but I really don't know. </p>

<p>Again, everything looks as it should when I run <code>echo</code> before the string of shell parameters. </p>

<p>If more of the script I'm using is needed to understand what I'm talking about, that is not a problem.</p>