sidneys / ffmpeg-progressbar-cli

A colored progress bar for FFmpeg.
https://npmjs.com/package/ffmpeg-progressbar-cli
MIT License
205 stars 20 forks source link

No output while in a dos batch file #6

Open zoomphoto opened 5 years ago

zoomphoto commented 5 years ago

This is perhaps because the batch file is stopping the output, but ffmpeg-bar works perfect from the command line, but when running in a batch file, there is no output. It is working perfectly (as in the files are created), but no output is shown during operation.

Sample one (this just concatenates video camera files)

` @echo off SETLOCAL ENABLEDELAYEDEXPANSION

mkdir n:__ftp_upload_watch_folder\%1

for /D %%D in ("n:\%1*") do (

for %%a in ("%%D.") do set currentfolder=%%~na

if exist "%%D*.mp4" ( echo Processing MP4 %%D ... (for %%I in ("%%D*.mp4") do echo file '%%~nxI') > %%D\mylist.txt

)
if exist "%%D\*.mts" (
    echo Processing MTS %%D ...
    (for %%I in ("%%D\*.mts") do @echo file '%%~nxI') > %%D\mylist.txt
)

cd %%D ffmpeg-bar -f concat -i "%%D\mylist.txt" -n -c copy "n:\%1\%1_!currentfolder:~0,2!_1.mp4" echo !currentfolder! > "n:__ftp_upload_watchfolder\%1\%1!currentfolder:~0,2!_1_compress.title"

) `

This is my second file which then compresses the newly minted concatenations. Same thing, it works, but no progress-bar:

@echo off SETLOCAL ENABLEDELAYEDEXPANSION mkdir n:\__ftp_upload_watch_folder\%1 cd %1 (for %%i IN (*.mp4) DO ffmpeg-bar -hide_banner -n -i %%i -vf scale=1280:-2 -c:v libx264 -r 29.97 -crf 23 n:\__ftp_upload_watch_folder\%1\%%~ni_compress%%~xi ) Thanks!

sebastienvercammen commented 4 years ago

Same issue when ffmpeg-bar is run from a python3 script via os.system().

This alternative works for py3:

subprocess.run(ffmpeg_command, shell=True)
BETLOG commented 4 years ago

You should fix your code markup above if you really want help, but that aside I find in linux bash scripts: Any time the ffmpeg command is inside nested loops I need to redirect ffmpegs output or it can break the loop... obviously you need appropriate syntax for windows.

Try slapping the windows-syntax equivalent of this at the very end of your command:

</dev/null

eg

ffmpeg .....-f mp4 -y "${exportName}" </dev/null