VideoHelp Forum




+ Reply to Thread
Results 1 to 9 of 9
  1. Member
    Join Date
    Apr 2015
    Location
    Argentina
    Search Comp PM
    Hello, I would like to know if someone knows a way of to run ffmpeg in several instances in parallel in windows. For example I want to convert several audio of a series but only with that is turn of 1 at the same time, using an only core of them 6 that can use. Already try using the program ppx2 that emulates the utility Xargs of linux but always me returns an error. Regret if not you can read well as use a translator.
    Thank you.

    example script in bat file
    set /p format=original format:
    set /p q=quality:
    for %%a in (*.%format%) do "ffmpeg.exe" -i "%%~na" -vn -c:a libvorbis -q %q% "output folder\%%~na.ogg"
    Last edited by arielacade; 29th Aug 2016 at 22:42.
    Quote Quote  
  2. At the command line type:

    Code:
    Start Name ffmpeg.exe (rest of command line)
    Repeat as necessary. Name is just a name for the process, it can be anything you want.
    Quote Quote  
  3. Member
    Join Date
    Apr 2015
    Location
    Argentina
    Search Comp PM
    Originally Posted by jagabo View Post
    At the command line type:

    Code:
    Start Name ffmpeg.exe (rest of command line)
    Repeat as necessary. Name is just a name for the process, it can be anything you want.
    I have several files in a folder and would like to convert them using a bat file to not write lines of command for each file.
    How could use the START command in a cmd or bat file?
    Last edited by arielacade; 29th Aug 2016 at 22:53.
    Quote Quote  
  4. You can use START in a batch file the same way you use any other program.

    for %%a in (*.%format%) do START "%%~na" "ffmpeg.exe"...

    The problem is that you'll need a way to limit the number of simultaneous instances. Ie, if there are 100 files to be processed you don't want to start all 100 at once. Maybe you could add a delay between each instance. For example, if you know each is going to take 5 minutes, add a 1 minute delay between each START. That way you'll only have 5 instances running at a time.
    Quote Quote  
  5. Modified .bat

    Code:
    @echo off
    Setlocal EnableDelayedExpansion
    set /p format=original format:
    set /p q=quality:
    set /a counter=0
    
    for %%a in (*.!format!) do IF !counter! LSS 5 (
    start ffmpeg.exe -i "%%a" -vn -c:a libvorbis -q %q% "%%~na.ogg"
    set /a counter=counter+1
    ) ELSE (
    start /w ffmpeg.exe -i "%%a" -vn -c:a libvorbis -q %q% "%%~na.ogg"
    set /a counter=0
    )
    Quote Quote  
  6. Originally Posted by videobruger View Post
    Modified .bat

    Code:
    @echo off
    Setlocal EnableDelayedExpansion
    set /p format=original format:
    set /p q=quality:
    set /a counter=0
    
    for %%a in (*.!format!) do IF !counter! LSS 5 (
    start ffmpeg.exe -i "%%a" -vn -c:a libvorbis -q %q% "%%~na.ogg"
    set /a counter=counter+1
    ) ELSE (
    start /w ffmpeg.exe -i "%%a" -vn -c:a libvorbis -q %q% "%%~na.ogg"
    set /a counter=0
    )
    Nice!
    Quote Quote  
  7. great idea to stop process at certain item, ..., I just had an idea that /w could be variable besides creating a subroutine, because process could be complex and using parentheses is always a trap in a sense using batch script, things get simple and subroutine can have other subroutines within if too complex etc.
    Code:
    @echo off
    set /p format=original format:
    set /p q=quality:
    set /a counter=0
    set "sign=NORMAL"
    for %%a in (*.%format%) do CALL :encode "%%a"
    pause
    exit
    
    :encode <audio file>
    start /%sign% ffmpeg.exe -i "%~1" -vn -c:a libvorbis -q %q% "%~n1.ogg"
    set /a counter = %counter% + 1
    if [%counter%]==[5] set "sign=WAIT"
    goto :eof
    Quote Quote  
  8. Member
    Join Date
    Apr 2015
    Location
    Argentina
    Search Comp PM
    Originally Posted by _Al_ View Post
    great idea to stop process at certain item, ..., I just had an idea that /w could be variable besides creating a subroutine, because process could be complex and using parentheses is always a trap in a sense using batch script, things get simple and subroutine can have other subroutines within if too complex etc.
    Code:
    @echo off
    set /p format=original format:
    set /p q=quality:
    set /a counter=0
    set "sign=NORMAL"
    for %%a in (*.%format%) do CALL :encode "%%a"
    pause
    exit
    
    :encode <audio file>
    start /%sign% ffmpeg.exe -i "%~1" -vn -c:a libvorbis -q %q% "%~n1.ogg"
    set /a counter = %counter% + 1
    if [%counter%]==[5] set "sign=WAIT"
    goto :eof
    Many thanks, this command worked perfectly. That is only a bit uncomfortable that is there will be so many windows cmd but that is one minor detail and as don't want to collapse my processor change [5] by [4] to realize 5 processes in simultaneous.
    Thanks to all for answering.
    Quote Quote  
  9. Originally Posted by arielacade View Post
    That is only a bit uncomfortable that is there will be so many windows
    START lets you specify that the new windows should start minimized. Or you can run all the processes in the current window. Type "START /?" for details.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!