0

I am using Zeranoes FFmpeg Builds for Windows and I can start the ff-prompt without installing anything. But how do I start ff-prompt.bat with Windows PowerShell? I have tried a few things like Invoke-Expression or changing the $env:Path but nothing seems to work, because all I get is the message

"C:\Users\Administrator>ECHO OFF

bin\ffmpeg.exe could not be found."

Is it even possible to start ff-prompt with PowerShell? Every suggestion / solution is more than welcome.

My goal is to have a solution that works like this here: http://spreadys.wordpress.com/2012/12/03/ffprobe-and-windows-powershell/

but I want to do that automatically for all my clips, thats why I need to start ffprobe with powershell.


ECHO OFF
REM FF Prompt 1.1
REM Open a command prompt to run ffmpeg/ffplay/ffprobe
REM Copyright (C) 2013  Kyle Schwarz

TITLE FF Prompt

IF NOT EXIST bin\ffmpeg.exe (
  CLS
  ECHO bin\ffmpeg.exe could not be found.
  GOTO:error
)

CD bin || GOTO:error
PROMPT $G
CLS
ffmpeg -version
SET PATH=%CD%;%PATH%
ECHO.
ECHO For help run: ffmpeg -h
ECHO For formats run: ffmpeg -formats ^| more
ECHO For codecs run: ffmpeg -codecs ^| more
ECHO.
ECHO Current directory is now: "%CD%"
ECHO The bin directory has been added to PATH
ECHO.

CMD /F:ON /Q /K
GOTO:EOF

:error
  ECHO.
  ECHO Press any key to exit.
  PAUSE >nul
  GOTO:EOF

Okay I tried something a little bit different this time:

$env:Path = ';C:\Users\Administrator\bin\'
$title = "A_Day_for_Cake_and_Accidents"
Start-Process ff-prompt.bat -ArgumentList "ffprobe -show_streams -select_streams v -print_format xml -count_frames C:\Users\Administrator\Desktop\dcp_bearbeitet\$title\$title.mov > C:\Users\Administrator\Desktop\dcp_bearbeitet\$title\totalframes.xml"

This creates a file called "totalframes.xml" but without the needed information, the only thing I get is:

C:\Users\Administrator>ECHO OFF ffmpeg version N-60959-g669043d built on Feb 27 2014 22:01:58 with gcc 4.8.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 66.100 / 52. 66.100 libavcodec 55. 52.102 / 55. 52.102 libavformat 55. 33.100 / 55. 33.100 libavdevice 55. 10.100 / 55. 10.100 libavfilter 4. 2.100 / 4. 2.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 18.100 / 0. 18.100 libpostproc 52. 3.100 / 52. 3.100 For help run: ffmpeg -h For formats run: ffmpeg -formats | more For codecs run: ffmpeg -codecs | more Current directory is now: "C:\Users\Administrator\bin" The bin directory has been added to PATH

So basically the console pops up, writes this standard text and does not use my commands which I stated in -Argument-List . I do not have a clue why it is ignoring most of my commands, except for writing everything in a XML file.

sebastian
  • 179
  • 1
  • 4
  • 10
  • Why do you need to start the batch file with PowerShell? – alroc Mar 05 '14 at 15:16
  • You should be able to call the batch file like any other application or script. Just give the name (with path if not in `$Env:PATH`). You should never need to use `Invoke-Expression` for such a thing, usually. The error message suggests a poorly-written batch file which fails to run from other directories than its own, though. – Joey Mar 05 '14 at 15:23
  • What are the contents of the bat file and what are you setting `$ENV:path` to? – arco444 Mar 05 '14 at 15:24
  • @alroc Because I need to work with informations from ffprobe. I have over 100 clips which I need to read out with ffprobe and I think its way easier to do this with PowerShell, so if I had a function which could start ffprobe automatically and give me the right informations of all clips, I would be very happy. – sebastian Mar 05 '14 at 15:26
  • I have tried this one: `$env:Path =+ ";C:\Users\Administrator\ffmpeg\bin\ffmpeg.exe"` and tried to `Start-Process C:\Users\Administrator\ffmpeg\ff-prompt.bat` but this is not working either. If I just would get this thing started with PowerShell I would be a happy man. – sebastian Mar 05 '14 at 15:42
  • That path is not correct. It should be to a directory not a file. Please post the contents of your bat file if you want help. – arco444 Mar 05 '14 at 18:25

2 Answers2

0

According to the ff-prompt.bat I found on a SVN repository, and your different comments, you should be in C:\Users\Administrator\ffmpeg directory to start this .bat file.

JPBlanc
  • 70,406
  • 17
  • 130
  • 175
  • Something happened, but not what I expected. PowerShell does not ask for the exe anymore and I see a small window popping up for a second and then its gone. The path where my ff-prompt lies looks like this: `C:\Users\Administrator`and my bin folder lies in the same path. I guess I am missing something, because I can not work with ff-prompt if it closes after a second. My first attempt was something like this: `$env:Path = ';C:\Users\Administrator\bin\'` `Start-Process ff-prompt.bat` – sebastian Mar 06 '14 at 16:20
0

You can launch ff-prompt.bat from PowerShell as follows. Firstly, set the working directory to that which contains ff-prompt.bat e.g. c:\users\administrator\ffmpeg. Secondly, type the following and press enter: .\ff-prompt.bat. I tested this with file set downloaded from Zeranoe and the CMD session opened and displayed as follows:

ffmpeg version N-61143-g64e4bd7
built on Mar  7 2014 00:01:08 with gcc 4.8.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig
--enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore
-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspee
x --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libv
orbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-z
lib
libavutil      52. 66.101 / 52. 66.101
libavcodec     55. 52.102 / 55. 52.102
libavformat    55. 33.101 / 55. 33.101
libavdevice    55. 11.100 / 55. 11.100
libavfilter     4.  3.100 /  4.  3.100
libswscale      2.  5.101 /  2.  5.101
libswresample   0. 18.100 /  0. 18.100
libpostproc    52.  3.100 / 52.  3.100

For help run: ffmpeg -h
For formats run: ffmpeg -formats | more
For codecs run: ffmpeg -codecs | more

Current directory is now: "C:\Users\Andy\Downloads\ffmpeg-20140307-git-64e4bd7-win32-static\ffmpeg-20140307-git-64e4bd7-
win32-static\bin"
The bin directory has been added to PATH

>
andyb
  • 2,722
  • 1
  • 18
  • 17
  • The above answer will re-use the PowerShell console window for the CMD prompt. If you want to launch CMD in a seperate window, use `start-process .\ff-prompt.bat` – andyb Mar 07 '14 at 13:26