ffmpeg does not accept variable name read from file [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I am attempting to batch download a number of videos using ffmpeg. A list of the site addresses and save names is stored in a text file in the following format.



"site",filename.mp4


The code that I have is looping through the file and attempting to download each line by line.



#!/bin/bash

while IFS=, read dl nm
do
echo $dl
echo $nm
/usr/bin/ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -i $dl -c copy $nm
done < $1


The expected output is that on each loop ffmpeg would download the file indicated by each line and then proceed to the next iteration of the loop.



Instead, ffmpeg outputs the error message



"site": No such file or directory


When I run the same command directly in the terminal with the site name and save name directly inserted into the command, it works without any issue.



Looking at other posts seemingly related to this I have tried appending



< /dev/null


to the end of the ffmpeg call but it still has the same affect.







share|improve this question












closed as off-topic by Jeff Schaller, Shadur, Archemar, Satō Katsura, Jesse_b Mar 17 at 17:30


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Shadur, Archemar, Satō Katsura, Jesse_b
If this question can be reworded to fit the rules in the help center, please edit the question.








  • 1




    This looks like an issue with your script. Which is the "input file" designator, the first or second option in the lines of text? If it's the first option, then are you sure that "site" is actually a file location that ffmpeg can access? Also, is there a reason you have thte "site" thing in quotes in the file itself? It'll read all that literally, so the $dl variable will be equal to "site" which is probably not what you're after.
    – Thomas Ward
    Mar 15 at 15:16











  • The input file is the first option. And as I mentioned, using the input file directly in the terminal with quotes does work. I just tested it with the modification "$dl" and removed the quote from the text file, which seems to be what you were referencing, and it appears to be working. Thank you.
    – Javan
    Mar 15 at 15:32











  • You're welcome. I summarized the findings and the proper solution that you tested in an answer, so you can mark the question as answered and accept the answer (if you wish)
    – Thomas Ward
    Mar 15 at 16:06














up vote
0
down vote

favorite












I am attempting to batch download a number of videos using ffmpeg. A list of the site addresses and save names is stored in a text file in the following format.



"site",filename.mp4


The code that I have is looping through the file and attempting to download each line by line.



#!/bin/bash

while IFS=, read dl nm
do
echo $dl
echo $nm
/usr/bin/ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -i $dl -c copy $nm
done < $1


The expected output is that on each loop ffmpeg would download the file indicated by each line and then proceed to the next iteration of the loop.



Instead, ffmpeg outputs the error message



"site": No such file or directory


When I run the same command directly in the terminal with the site name and save name directly inserted into the command, it works without any issue.



Looking at other posts seemingly related to this I have tried appending



< /dev/null


to the end of the ffmpeg call but it still has the same affect.







share|improve this question












closed as off-topic by Jeff Schaller, Shadur, Archemar, Satō Katsura, Jesse_b Mar 17 at 17:30


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Shadur, Archemar, Satō Katsura, Jesse_b
If this question can be reworded to fit the rules in the help center, please edit the question.








  • 1




    This looks like an issue with your script. Which is the "input file" designator, the first or second option in the lines of text? If it's the first option, then are you sure that "site" is actually a file location that ffmpeg can access? Also, is there a reason you have thte "site" thing in quotes in the file itself? It'll read all that literally, so the $dl variable will be equal to "site" which is probably not what you're after.
    – Thomas Ward
    Mar 15 at 15:16











  • The input file is the first option. And as I mentioned, using the input file directly in the terminal with quotes does work. I just tested it with the modification "$dl" and removed the quote from the text file, which seems to be what you were referencing, and it appears to be working. Thank you.
    – Javan
    Mar 15 at 15:32











  • You're welcome. I summarized the findings and the proper solution that you tested in an answer, so you can mark the question as answered and accept the answer (if you wish)
    – Thomas Ward
    Mar 15 at 16:06












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am attempting to batch download a number of videos using ffmpeg. A list of the site addresses and save names is stored in a text file in the following format.



"site",filename.mp4


The code that I have is looping through the file and attempting to download each line by line.



#!/bin/bash

while IFS=, read dl nm
do
echo $dl
echo $nm
/usr/bin/ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -i $dl -c copy $nm
done < $1


The expected output is that on each loop ffmpeg would download the file indicated by each line and then proceed to the next iteration of the loop.



Instead, ffmpeg outputs the error message



"site": No such file or directory


When I run the same command directly in the terminal with the site name and save name directly inserted into the command, it works without any issue.



Looking at other posts seemingly related to this I have tried appending



< /dev/null


to the end of the ffmpeg call but it still has the same affect.







share|improve this question












I am attempting to batch download a number of videos using ffmpeg. A list of the site addresses and save names is stored in a text file in the following format.



"site",filename.mp4


The code that I have is looping through the file and attempting to download each line by line.



#!/bin/bash

while IFS=, read dl nm
do
echo $dl
echo $nm
/usr/bin/ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -i $dl -c copy $nm
done < $1


The expected output is that on each loop ffmpeg would download the file indicated by each line and then proceed to the next iteration of the loop.



Instead, ffmpeg outputs the error message



"site": No such file or directory


When I run the same command directly in the terminal with the site name and save name directly inserted into the command, it works without any issue.



Looking at other posts seemingly related to this I have tried appending



< /dev/null


to the end of the ffmpeg call but it still has the same affect.









share|improve this question











share|improve this question




share|improve this question










asked Mar 15 at 14:24









Javan

32




32




closed as off-topic by Jeff Schaller, Shadur, Archemar, Satō Katsura, Jesse_b Mar 17 at 17:30


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Shadur, Archemar, Satō Katsura, Jesse_b
If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by Jeff Schaller, Shadur, Archemar, Satō Katsura, Jesse_b Mar 17 at 17:30


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, Shadur, Archemar, Satō Katsura, Jesse_b
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 1




    This looks like an issue with your script. Which is the "input file" designator, the first or second option in the lines of text? If it's the first option, then are you sure that "site" is actually a file location that ffmpeg can access? Also, is there a reason you have thte "site" thing in quotes in the file itself? It'll read all that literally, so the $dl variable will be equal to "site" which is probably not what you're after.
    – Thomas Ward
    Mar 15 at 15:16











  • The input file is the first option. And as I mentioned, using the input file directly in the terminal with quotes does work. I just tested it with the modification "$dl" and removed the quote from the text file, which seems to be what you were referencing, and it appears to be working. Thank you.
    – Javan
    Mar 15 at 15:32











  • You're welcome. I summarized the findings and the proper solution that you tested in an answer, so you can mark the question as answered and accept the answer (if you wish)
    – Thomas Ward
    Mar 15 at 16:06












  • 1




    This looks like an issue with your script. Which is the "input file" designator, the first or second option in the lines of text? If it's the first option, then are you sure that "site" is actually a file location that ffmpeg can access? Also, is there a reason you have thte "site" thing in quotes in the file itself? It'll read all that literally, so the $dl variable will be equal to "site" which is probably not what you're after.
    – Thomas Ward
    Mar 15 at 15:16











  • The input file is the first option. And as I mentioned, using the input file directly in the terminal with quotes does work. I just tested it with the modification "$dl" and removed the quote from the text file, which seems to be what you were referencing, and it appears to be working. Thank you.
    – Javan
    Mar 15 at 15:32











  • You're welcome. I summarized the findings and the proper solution that you tested in an answer, so you can mark the question as answered and accept the answer (if you wish)
    – Thomas Ward
    Mar 15 at 16:06







1




1




This looks like an issue with your script. Which is the "input file" designator, the first or second option in the lines of text? If it's the first option, then are you sure that "site" is actually a file location that ffmpeg can access? Also, is there a reason you have thte "site" thing in quotes in the file itself? It'll read all that literally, so the $dl variable will be equal to "site" which is probably not what you're after.
– Thomas Ward
Mar 15 at 15:16





This looks like an issue with your script. Which is the "input file" designator, the first or second option in the lines of text? If it's the first option, then are you sure that "site" is actually a file location that ffmpeg can access? Also, is there a reason you have thte "site" thing in quotes in the file itself? It'll read all that literally, so the $dl variable will be equal to "site" which is probably not what you're after.
– Thomas Ward
Mar 15 at 15:16













The input file is the first option. And as I mentioned, using the input file directly in the terminal with quotes does work. I just tested it with the modification "$dl" and removed the quote from the text file, which seems to be what you were referencing, and it appears to be working. Thank you.
– Javan
Mar 15 at 15:32





The input file is the first option. And as I mentioned, using the input file directly in the terminal with quotes does work. I just tested it with the modification "$dl" and removed the quote from the text file, which seems to be what you were referencing, and it appears to be working. Thank you.
– Javan
Mar 15 at 15:32













You're welcome. I summarized the findings and the proper solution that you tested in an answer, so you can mark the question as answered and accept the answer (if you wish)
– Thomas Ward
Mar 15 at 16:06




You're welcome. I summarized the findings and the proper solution that you tested in an answer, so you can mark the question as answered and accept the answer (if you wish)
– Thomas Ward
Mar 15 at 16:06










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










There's some issues with your script, in that you're using quotes in the file with download URLs/locations.



Namely, that when you have the file the way you do, $dl becomes "site" and$nm` remains as you'd expect.



In order to do this, you either need to change the file so that the site download locations don't have quotes, and then you need to set quotes around $dl in the script.



So you'd end up with this:



input file list:



site,foobar.baz


Script:



#!/bin/bash

while IFS=, read dl nm
do
echo $dl
echo $nm
/usr/bin/ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -i "$dl" -c copy $nm
done < $1


You might also want to wrap $nm in quotes as well in case you have a filename that has spaces in it, but that's your decision or not.






share|improve this answer



























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    There's some issues with your script, in that you're using quotes in the file with download URLs/locations.



    Namely, that when you have the file the way you do, $dl becomes "site" and$nm` remains as you'd expect.



    In order to do this, you either need to change the file so that the site download locations don't have quotes, and then you need to set quotes around $dl in the script.



    So you'd end up with this:



    input file list:



    site,foobar.baz


    Script:



    #!/bin/bash

    while IFS=, read dl nm
    do
    echo $dl
    echo $nm
    /usr/bin/ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -i "$dl" -c copy $nm
    done < $1


    You might also want to wrap $nm in quotes as well in case you have a filename that has spaces in it, but that's your decision or not.






    share|improve this answer
























      up vote
      0
      down vote



      accepted










      There's some issues with your script, in that you're using quotes in the file with download URLs/locations.



      Namely, that when you have the file the way you do, $dl becomes "site" and$nm` remains as you'd expect.



      In order to do this, you either need to change the file so that the site download locations don't have quotes, and then you need to set quotes around $dl in the script.



      So you'd end up with this:



      input file list:



      site,foobar.baz


      Script:



      #!/bin/bash

      while IFS=, read dl nm
      do
      echo $dl
      echo $nm
      /usr/bin/ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -i "$dl" -c copy $nm
      done < $1


      You might also want to wrap $nm in quotes as well in case you have a filename that has spaces in it, but that's your decision or not.






      share|improve this answer






















        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        There's some issues with your script, in that you're using quotes in the file with download URLs/locations.



        Namely, that when you have the file the way you do, $dl becomes "site" and$nm` remains as you'd expect.



        In order to do this, you either need to change the file so that the site download locations don't have quotes, and then you need to set quotes around $dl in the script.



        So you'd end up with this:



        input file list:



        site,foobar.baz


        Script:



        #!/bin/bash

        while IFS=, read dl nm
        do
        echo $dl
        echo $nm
        /usr/bin/ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -i "$dl" -c copy $nm
        done < $1


        You might also want to wrap $nm in quotes as well in case you have a filename that has spaces in it, but that's your decision or not.






        share|improve this answer












        There's some issues with your script, in that you're using quotes in the file with download URLs/locations.



        Namely, that when you have the file the way you do, $dl becomes "site" and$nm` remains as you'd expect.



        In order to do this, you either need to change the file so that the site download locations don't have quotes, and then you need to set quotes around $dl in the script.



        So you'd end up with this:



        input file list:



        site,foobar.baz


        Script:



        #!/bin/bash

        while IFS=, read dl nm
        do
        echo $dl
        echo $nm
        /usr/bin/ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -i "$dl" -c copy $nm
        done < $1


        You might also want to wrap $nm in quotes as well in case you have a filename that has spaces in it, but that's your decision or not.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 15 at 16:05









        Thomas Ward

        1,3182927




        1,3182927












            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay