VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Hello all. I am new to using FFMPEG to download streams. I am very impressed with it and enjoying learning about it a lot. But I am just getting going, so I have some questions for more experienced users.

    1. Is there any way to automate downloads of multiple videos/video stream chunks? Queue a bunch up somehow? Use a list of files to download and automate downloading? Would a GUI for FFMPEG perhaps assist in this?

    2. What is the best way to batch process combining multiple videos that download in multiple pieces? I already know how to combine them, I just want a way to do batch. Again, would a certain FFMPEG GUI help here? All I would be doing is combing the pieces of the same video, no conversion, encoding, whatever...

    3. Is there any way to download the videos/video chunks with the original name of the video and following it a 1, 2, 3, etc... for each chunk as opposed to output.mp4 like I currently am doing and then having to rename each one manually before I can download again? How do you get the file name and apply it to the download? Even a 1, 2, 3, etc... (with no file name) naming scheme would be better... And to clarify a command line code would have to save them as one number higher each time. Any unique name really would do, with something relating to the filename, and position of each chunk being optimal of course. And is it possible to send all of the chunks for one video to a folder of that same name for organizations sake?

    I think that's about it for now. Hopefully someone can give me some good advice to streamline my operation. Thanks in advance!
    Last edited by adidasos; 6th Feb 2019 at 14:53.
    Quote Quote  
  2. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    In Windows command/batch file, read filenames (or URLs) one line at a time from a text file, process with FFmpeg, and output with an incrementing number.

    Code:
    setlocal enabledelayedexpansion
    set index=0
    for /f "delims=" %%F in (myfilelist.txt) do (
        set /a index+=1
        ffmpeg.exe -i %%F [options] output_!index!.mp4 [or whatever the extension is]
    )
    Quote Quote  
  3. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Wow, that sounds great! Thanks for the suggestion, and the code to do it, can't wait to give it a try.
    Quote Quote  
  4. Or, since you're building a list of files, you can just call ffmpeg sequentially in a simple batch file:
    Code:
    ffmpeg -i URL1 FileName1.mp4
    ffmpeg -i URL2 FileName2.mp4
    ffmpeg -i URL3 FileName3.mp4
    Quote Quote  
  5. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    "Or, since you're building a list of files, you can just call ffmpeg sequentially in a simple batch file:
    Code:

    ffmpeg -i URL1 FileName1.mp4
    ffmpeg -i URL2 FileName2.mp4
    ffmpeg -i URL3 FileName3.mp4

    "


    I'm not sure how to make a batch file, I'll look into it. However, I like the idea of this doing it this way. I'm currently putting the download code in before & after the stream URLs I'm downloading in Notepad++, then copying into a command prompt with admin rights to download, so I think it shouldn't be too hard to convert them to a batch file and then I can do them all with one command hopefully. So great idea, thanks!

    "setlocal enabledelayedexpansion
    set index=0
    for /f "delims=" %%F in (myfilelist.txt) do (
    set /a index+=1
    ffmpeg.exe -i %%F [options] output_!index!.mp4 [or whatever the extension is]
    )"

    I can't for the life of me get this line of code to work. I tried doing it all kinds of different ways, and it just always gives errors. I went the route of putting the file that is the download list and the ffmpeg.exe file in the same folder and trying to run the script on them that way, but no go. I tried editing it all kinds of different ways. The only code I myself use for my process of downloading and combining is:

    ffmpeg -i "URL HERE" -c copy -bsf:a aac_adtstoasc "output.mp4"

    (for downloading)

    and:

    (for %i in (*.mp4) do @echo file '%i') > mylist.txt
    ffmpeg -f concat -i mylist.txt -c copy output.mp4

    (for combining)

    It was frustrating I'm not getting it to work, but it is at least telling me how the code needs to be structured to work if I put things in the wrong order, so that's nice and helpful anyways. I will have to give it another go later...
    Quote Quote  
  6. A batch file is just a text file with all the commands you want to run -- but with the extension .BAT instead of .TXT. You can create it with any text editor, like NotePad. The code that JVRaines gave is also a batch file. To run a batch file you can double click on it in Explorer. Or open CMD.COM and type the name of the batch file.

    ffmpeg will automatically concatenate segments if you give it a playlist (m3u8, mpd, etc.) rather than the individual filenames.
    Quote Quote  
  7. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Success, the batch file works great! Thanks Jagabo! Is there any way to leave the command prompt open at the end of the process to check the command prompt window for downloading errors? Thanks again for the batch file suggestion, now I can download while I sleep or work.
    Quote Quote  
  8. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Originally Posted by adidasos View Post
    I can't for the life of me get this line of code to work.
    The stuff I put in square brackets is comment/pseudocode only and should not be used literally.
    • If the folder containing the FFmpeg executable file is not in your environmental PATH variable and the current folder is not the folder containing ffmpeg.exe, then you have to specify the complete path to the file. For example, "c:\program files\ffmpeg\bin\ffmpeg.exe". If the path contains spaces, it must be enclosed in double quotes.
    • If the current folder is not the folder containing the text file with the list of file names, then you have to specify the complete path to the file. If the path contains spaces, it must be enclosed in double quotes.
    • [options] must be replaced with the options you are passing to FFmpeg.
    Try this instead.
    Code:
    setlocal enabledelayedexpansion
    set index=0
    for /f "delims=" %%F in (myfilelist.txt) do (
        set /a index+=1
        ffmpeg.exe -i %%F -c copy -bsf:a aac_adtstoasc output_!index!.mp4
    )
    Quote Quote  
  9. Originally Posted by adidasos View Post
    Is there any way to leave the command prompt open at the end of the process to check the command prompt window for downloading errors?
    Put "pause" at the end of the script.

    Code:
    ffmpeg -i URL1 FileName1.mp4
    ffmpeg -i URL2 FileName2.mp4
    ffmpeg -i URL3 FileName3.mp4
    pause
    Quote Quote  
  10. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    @JVRaines

    Script revision works perfectly man, thanks!

    @jagabo

    Pause works perfectly, thanks bro!
    Quote Quote  



Similar Threads